Update shared volume from data container
The named volume webroot
is meant to persist data across container restart/rebuilds. The only time the data in the volume is updated from an image is when the volume is created, and the contents of the directory in the image are copied in.
It looks like you mean to use volumes_from
which is how you get container to mount volumes defined on data
. This is the original "data container" method of sharing data that volumes were designed to replace.
version: "2.1"services: server: image: busybox volumes_from: - data command: ls -l /var/www/html fpm: image: busybox volumes_from: - data command: ls -l /var/www/html data: build: . image: dply/data volumes: - /var/www/html
Note that this has been replaced in version 3 of the compose file so you may need to stick with recreating the volume if you want to use newer features.