If you’re building a Docker image on Windows you’ll want to make your application files available to the Docker VM for inclusion in the container.
C:\Users on your Windows host will be accessible under
/c/Users in the Docker VM.
To make any directory available to the VM, you simply need to add it as a shared directory in VirtualBox, and then mount it on the VM:
- Open the VM VirtualBox Manager that was installed with boot2docker and open the settings dialog.
- Select the ‘Shared Folders’ item from the menu and add a new shared folder definition.
- Set the folder path to the directory you want available to the VM (eg, your app root directory) and give it a sensible name, eg ‘my-application’.
- Create a new directory on the Docker VM that will contain your application contents, eg:
- Mount your shared application directory to the directory you just created, eg:
sudo mount -t vboxsf my-application ~/my-application-contents
That’s it. You can now treat
~/my-application-contents as your application working directory and target any of its contents in your Dockerfile.