Using Docker on Windows without Hyper-V — Troubleshooting tips
Time is important, some would say it’s money. I want to save your time by sharing tips on how to use Docker on a Windows not supporting Hyper-V.
To use the official Docker for Windows you need a professional version which let you activate the Hyper-V features. On a Windows Home version, like I am using for my side-projects, you should install Docker Toolbox. It’s seems simple, but I encountered some surprising issues which took me time to solve (I may update the list as I discover new problems !).
Default docker machine location is C:\Users\username — How to change it ?
My first installation of the Docker Toolbox was a fail, I needed to start again, here is why.
I always take care of not overloading my C: drive which is a SSD with a small remaining space, containing almost only Windows. I was able to choose to install docker on my D: drive, so the installation went well. However, when I launched the so-callled Docker Quickstart Terminal, it has automatically created a new Docker machine in my C:\Users\username\.docker\ directory ! The machine took almost 2GB, so I clearly don’t want it on my SSD.
I came across this stackoverflow question, which helped me a lot. As mentioned, the way to change the location of the docker machine that will be created is to use the MACHINE_STORAGE_PATH environment variable.
I tried it but the Docker terminal was not launching correctly, saying it can’t find the machine anymore. So I decided to make a fresh start and remove everything by following these steps :
- Delete the docker machine :
docker-machine rm default(“default” is the name of machine created automatically). - Remove the C:\Users\username\.docker folder
- Uninstall the Docker Toolbox program from Windows
After this, I added the MACHINE_STORAGE_PATH environment variable to another drive, but I saw that the uninstallation didn’t cleared other environment variables. You may also need to edit the DOCKER_CERT_PATH variable like in the image below :

After a new installation of Docker Toolbox, everything was ok !
Unable to use http://localhost/ to access the containerized application
If you run your container like this :
docker run -p 5000:80 mycontainerYou normally expect to access it from the browser by typing localhost:5000, but you will have the error : This site can’t be reached. You will search for the problem in your code for maybe hours… But the solution is simple, you simply can’t access your app with localhost, you need to use the ip of your docker machine which can be found with the docker-machine ip command. Generally, it is set to 192.168.99.100. In fact, when using Docker Toolbox, the docker host is not really running on your machine but in a VM (VirtualBox), so you have to use the VirtualBox IP adress instead.
So typing http://192.168.99.100:5000/ will work !
Unable to mount volumes outside of C:\Users\username directory
Sometimes you want to use volumes with Docker. A common use case when developping a new application is to hot reload the application after every code change. It’s only possible if your local folder containing the code is shared with the docker container.
docker run -p 80:80 -v /my-project/src:/usr/src/app mycontainerBut it won’t work since Docker has limited access to your filesystem and can’t access outside your user directory in the C: drive.
One way to deal with this is to directly configure the shared folder of your VirtualBox machine ! This article helped me to find a solution and also this Github issue.
As I’m lazy, I don’t want to go on the VirtualBox GUI each time I want to use volumes with Docker… Instead we will use the command line :
vboxmanage sharedfolder add default -name myapp -hostpath —transient
docker-machine ssh default "sudo mkdir -p /my-project/src"
docker-machine ssh default "sudo mount -t vboxsf
-o defaults,uid=`id -u`,gid=`id -g` myapp /my-project/src"But typing this in the terminal everytime can be exhausting, so someone made a tool for it ! I didn’t try it out but it can be interesting.
Personally, I like to put a docker-start.sh script at the root of my project which contains :
#!/bin/bash
PROJECT_PATH=${PWD}
PROJECT_NAME=${PWD##*/}sharedfolder_exists=`vboxmanage showvminfo default | grep "Name: '${PROJECT_NAME}'"`
if [[ -z $sharedfolder_exists ]]
then
vboxmanage sharedfolder add default --name ${PROJECT_NAME} --hostpath ${PROJECT_PATH} --transient
docker-machine ssh default "sudo mkdir -p ${PROJECT_PATH}"
docker-machine ssh default "sudo mount -t vboxsf -o defaults,uid=`id -u`,gid=`id -g` ${PROJECT_NAME} ${PROJECT_PATH}"
else
echo "INFO : Shared folder already set"
fidocker run -p 80:80 -v /my-project/src:/usr/src/app mycontainer
Note : This script is assuming you run it from the folder where it is located. It take the current path of the project (with the pwd command) and configure it as a shared folder in VirtualBox.
That’s it for now. I hope it helps some of you !