Fixing Volumes in Docker Toolbox

Fixing Volumes in Docker ToolboxCharles StoverBlockedUnblockFollowFollowingJun 6There is not a lot of documentation for Docker on Windows, and there’s even less on harnessing the power of volumes therein.

If you are like me, you may have spent a lot of time scratching your head over why your volumes simply aren’t mounting.

There are countless help requests scattered through the Docker GitHub and its relatives, and there are equally as many “fixes” that simply do not work.

So I’m here to report what worked both times this was an issue for me.

When running your container, use //x/ to reference your drive, where x is your lowercase drive letter.

To reference C:Usersadminvolume, you would use //c/Users/admin/volume.

Configure Oracle VirtualBox to have access to that folder.

This is an important solution that is not well documented.

Oracle VirtualBox, the virtual machine behind Docker Toolbox, does not have access to your folders by default.

Mounting C:MyFolder does nothing until you’ve given VirtualBox access to that folder.

Find VirtualBox on your machine and run it.

2.

Right-Click the default machine and choose Settings.

3.

Choose the Shared Folders category and add a shared folder.

Give the folder a convenient name.

It is what you will type when you mount it via –volume or -v.

Make it auto-mount and permanent.

In my case, if I docker run –volume //d/docker/nginx:/etc/nginx, I will be binding the /etc/nginx directory in my container to D:Program FilesDocker Toolbox.ginx.

I am not suggesting you use the Docker Toolbox directory — you can use any one you want.

I only used it as an example.

You may need to restart the default machine for your changes to take effect.

You may do so by right-clicking it and choosing the ‘Reset’ option.

Binding your volumes should now work.

.. More details

Leave a Reply