Home | Send Feedback

Installing Docker on Windows 10 Home from scratch

Published: January 14, 2019  •  linux

Docker Toolbox is the convenient option if you want to set up a Docker environment on Windows 10 Home.

But I was curious if it is possible to set up Docker without installing anything (installing meaning running an installer). My goal was to download a few executables, copy them into an arbitrary folder and set some environment variables and it should work.

Docker

In this tutorial I'm going to copy all the files into c:\docker. Change the commands accordingly with the folder you use.

  1. Install VirtualBox. The only component we have to install. Download the installer from the download page and run it. After the installation, reboot the computer.

  2. Download docker-machine. We need docker-machine for creating Docker hosts in VirtualBox. Check the release page and download the latest release

    cd c:\docker
    curl -L https://github.com/docker/machine/releases/download/v0.16.1/docker-machine-Windows-x86_64.exe --output docker-machine.exe
    
  3. Install boot2docker as Docker host in VirtualBox. Change the memory settings if you want to give Docker more or less memory.

    docker-machine create --driver virtualbox --virtualbox-memory 4096 default
    

    After the installation, check if the virtual machine is working.

    docker-machine ssh
    

    This command opens a SSH connection to boot2docker. Type exit to close the connection.

    To print the IP address of your Docker virtual machine run

    docker-machine ip
    
  4. Download docker-client.

    curl -L https://dockermsft.blob.core.windows.net/dockercontainer/docker-18-09-0.zip --output docker-18-09-0.zip
    

    Unzip the file into c:\docker and delete dockerd.exe, the Docker daemon. You should end up with a folder that contains docker.exe and a bunch of dlls.

    files

  5. Create a batch file start_docker.bat in the c:\docker folder and insert the following commands.

    docker-machine start
    docker-machine.exe env --shell cmd >c:\docker\setenv.bat
    call c:\docker\setenv.bat
    del c:\docker\setenv.bat
    

    This batch file starts the docker host and sets environment variables, so we can run docker-client on Windows

  6. Add c:\docker to the system path.
    Open System Properties. From the command line you can run this command: sysdm.cpl
    Open Advanced -> Environment Variables and add the directory to the Path variable.

    System properties

    After a reboot, you can open a Command Prompt and start your Docker environment with start_docker

  7. Lastly, we setup shared folders. You can configure a shared folder via Command Prompt with the vboxmanage tool. In this example I map the Windows folder c:\docker\data to the Docker host. Ensure that the folder exists before you run the command.

     docker-machine stop
     "c:\Program Files\Oracle\VirtualBox\vboxmanage" sharedfolder add default --name "data" --hostpath "c:\docker\data" --automount
     docker-machine start
    

    You can achieve the same by entering the info manually in the VirtualBox GUI. Shared Folders

    Next, we need to create a folder inside the virtual machine and mount the shared folder.

    docker-machine.exe ssh default "sudo mkdir -p /mnt/data"
    docker-machine.exe ssh default "sudo mount -t vboxsf data /mnt/data"
    

    Add these two commands to the start_docker.bat script, because the mount is not persistent and you need to run the command each time you boot the virtual machine.

    To test the setup create index.html in c:\docker\data and start Nginx in a container

     docker run --name some-nginx -v /mnt/data:/usr/share/nginx/html:ro -d -p 8080:80 nginx
    

    Check IP address of your docker host

    docker-machine.exe ip
    

    and open a browser with this IP address and port 8080. If everything works you should see your HTML page.

Docker-Compose

Another tool you might need, especially if you're start doing some more advanced things with Docker, is docker-compose. Check the download page for the latest release and download it.

curl -L https://github.com/docker/compose/releases/download/1.23.2/docker-compose-Windows-x86_64.exe --output docker-compose.exe

Kubernetes

Minikube is a great tool if you're start experimenting with Kubernetes. It installs a single-node Kubernetes cluster inside a VM.

Check the release page for the latest minikube version.

Check the documentation about kubectl for the latest version:

curl -L https://github.com/kubernetes/minikube/releases/download/v0.32.0/minikube-windows-amd64 --output minikube.exe
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/windows/amd64/kubectl.exe --output kubectl.exe
minikube.exe start

start installs a new virtual machine in VirtualBox. It does not reuse the existing boot2docker machine. It takes a while until all containers are set up.


This concludes our Docker installation from scratch. As mentioned at the beginning it is easier to install Docker Toolbox. This was just an experiment to see if it is possible to set up a Docker environment only by installing VirtualBox and then downloading a bunch of files.