Reputation: 5073
I'm trying to use a Magento file located on my docker container by mounting a volume with the command:
docker run -it -v /local/path/on/my/host:/var/www/html/app image_id
I can't figure out how to share the container files on my host. I created a symlink for the file but my PHP script on my host says it doesn't exist when I require it.
I followed this tutorial on digital ocean: https://www.digitalocean.com/community/tutorials/how-to-share-data-between-the-docker-container-and-the-host
Any ideas on how to do this?
Upvotes: 1
Views: 256
Reputation: 1329222
For a bind mount, you should specify the full path of the file in the container, not its parent folder:
docker run -it -v /local/path/on/my/host:/var/www/html/app/host image_id
^^^^^^
Note that for testing, once a container is running, you can also use dockder cp
to copy some files at runtime.
docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH
Upvotes: 1