For Windows 10 Home 2004 users I no longer recommend this setup. Check out the following blog post instead:
Docker Toolbox is the convenient option if you want to set up a Docker environment on Windows 10 Home.
However, 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, set some environment variables, and it should work.
In this tutorial, I'm going to copy all the files into
c:\docker. Change the commands accordingly with the folder you use.
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.
docker-machine. We need
docker-machinefor 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.2/docker-machine-Windows-x86_64.exe --output docker-machine.exe
Install tinycorelinux 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.
This command opens an SSH connection to tinycorelinux. Type
exitto close the connection.
To print the IP address of your Docker virtual machine run
curl -L https://dockermsft.blob.core.windows.net/dockercontainer/docker-19-03-5.zip --output docker-19-03-5.zip
Unzip the file into
dockerd.exe, the Docker daemon. You should end up with a folder that contains
docker.exeand a bunch of dlls.
Create a batch file
c:\dockerfolder 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 that we can run docker-client on Windows.
c:\dockerto the system path.
Open System Properties. From the command line, you can run this command:
Open Advanced -> Environment Variables and add the directory to the Path variable.
After a reboot, you can open a Command Prompt and start your Docker environment with
Lastly, we set up shared folders. You can configure a shared folder via Command Prompt with the
vboxmanagetool. In this example, I map the Windows folder
c:\docker\datato 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.
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.batscript, 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
c:\docker\dataand start Nginx in a container. Make sure that you run
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
and open a browser with this IP address and port 8080. If everything works, you should see your HTML page.
Another tool you might need, especially if you 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.25.5/docker-compose-Windows-x86_64.exe --output docker-compose.exe
Minikube is an excellent tool if you start experimenting with Kubernetes. It installs a single-node Kubernetes cluster inside a VM.
Check the release page for the latest
Check the documentation about
kubectl for the latest version:
curl -L https://github.com/kubernetes/minikube/releases/download/v1.9.2/minikube-windows-amd64.exe --output minikube.exe curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/windows/amd64/kubectl.exe minikube.exe start
start installs a new virtual machine in VirtualBox. It does not reuse the existing tinycorelinux machine. It takes a while until all containers are set up.
This concludes our Docker installation from scratch.