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.
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.1/docker-machine-Windows-x86_64.exe --output docker-machine.exe
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.
This command opens a SSH connection to boot2docker. 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-18-09-0.zip --output docker-18-09-0.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 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 setup 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
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'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
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
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.