2

I initially configured my docker setup for Docker for Windows. Everything worked great. I'm using docker-compose to define 3 containers, each of which have a volume being mapped from my ./src (path on host) to /src/ (path on container).

I recently found out that the production server might have Windows 10 Home, which doesn't support Docker for Windows. So, my thinking is that I should revert to docker toolbox to be prepared for that scenario.

So I uninstalled Docker for Windows and installed Docker toolbox. I can build my images with docker-compose build just fine, but now when I run docker compose up -d, 2 of my containers immediately crash because the /src/ directory never gets mounted.

I can verify that the volumes are not getting mounted by running docker exec -it ng01 bash and seeing that the volume directory exists but is empty. 2 of my co-workers can reproduce this issue on their windows machines with docker toolbox.

Does anyone know why this is happening, or how to get around it? I've been looking at a bunch of similar SO posts, but the various solutions have gotten me nowhere. I would appreciate some guidance.

Here is my docker-compose file.

I have my source code in src/.

I have my Dockerfiles in docker/

Here is hotloader.Dockerfile. Here is web.Dockerfile. I don't think they are the issue, but I might as well share them anyways.

Thank you in advance!

Luis Naranjo
  • 649
  • 7
  • 18
  • Where is your source project folder? Is this under your user directory in Windows. Docker Toolbox/Docker Machine only mounts directories under the user folder into the VM, please see https://github.com/docker/compose/issues/2548 for more details. – nwinkler Mar 29 '17 at 08:47

1 Answers1

0

Docker Toolbox for Windows works by setting up a VirtualBox VM named default. Running any docker command forwards that command to the VM (Windows Machine → Virtual Machine → Docker). To mount local Windows folders as Docker volumes, those folders first need to be shared and mounted on the VM that is running Docker. By default, C:\Users is shared, so mounting volumes from that location will work without any configuration.

So you can either move your project on this already shared location(C:\Users) or you can follow the steps in this document https://headsigned.com/posts/mounting-docker-volumes-with-docker-toolbox-for-windows/

Hope this helps! :)

Khushboo Mulani
  • 389
  • 1
  • 3
  • 10
  • I can't figure out what to do to make this work, there is no VirtualBox Manager on the machine (that I can tell, no program to run to do that, or anything) - I've only installed Docker, not VirtualBox, no clue what the config file is that they are editing in the link (which is pretty old)... I've got 2 machines running Windows Pro, and I've mounted directories on both and they quietly didn't mount, upgraded Docker restarted containers and all my data went POOF! – Traderhut Games Feb 25 '22 at 02:44