Docker Community Forums

Share and learn in the Docker community.

Can i mount a directory from local machine to a container which is running on a virtual machine?

docker

(Sharath Kumar) #1

I have source code existing on my local machine. i want to mount it to a container which is running on a virtual machine. The container uses phoenix framework image.
docker run --name elixirphoenix -it -v ~/path/to/HelloWorld:/app/code -p 4000:4000 sharathkumar3011/docker-phoenix
~/path/to/HelloWorld is the path to sorce code on my local machine.
The above command executes successfully when i run it on local machine. But when i try to run on my virtualmachine it does not mount the HelloWorld directory to /app/code in my container.

Please can anybody guide me?


(Dvohra) #2

Copy the source code directory to the virtual machine. Alternatively, create a shared directory between the local machine and the virtual machine. Which virtualization software is used? For VirtualBox refer
https://help.ubuntu.com/community/VirtualBox/SharedFolders