Reputation: 241
I have created a mount on my container which maps a physical path on the server to a path within the docker container. However, when files are placed within the containers path, those files are not appearing on the servers path (and vice versa)
Here is my docker run cmd:
docker run -d -p 127.0.0.1:7001:5000 --name myContainer myContainer -v /var/www/Images:/app/wwwroot/
Server is running CentOS. My application that runs within this docker container places files in the app/wwwroot
folder within its container. I expected these files to also appear on the servers /var/www/Images
folder but they do not.
Any ideas why?
Thanks
Upvotes: 0
Views: 892
Reputation: 59946
I expected these files to also appear on the servers /var/www/Images folder but they do not.
You map mount a directory or path /app/wwwroot
will be overridden (hide) by the host files, as -v
option tells to the docker I am going to override anything inside Docker with host files.
When you use a bind mount, a file or directory on the host machine is mounted into a container. The file or directory is referenced by its full or relative path on the host machine.
Or if you expect to copy from container then one way is to start container
docker run -it --rm --name test my_container
then copy files from container
docker cp my_container:/app/wwwroot/ /var/www/Images
Now bind you have docker files under /var/www/Images
.
Upvotes: 1