Run Docker On Windows 10 Home

/ Comments off

Older Windows 10 versions could already do that but only with the Pro and Enterprise edition. On Windows 10 Home you always had to run the Docker host as virtual machine inside VirtualBox. With the new Windows release this is a thing of the past and running Docker on Windows 10 Home is much easier. In this blog post, I show you step by step how. Windows Subsystem for Linux is a Linux environment that could be installed on Windows 10 machines and then could be used to run Linux binaries. But WSL 1 was too limited to be compatible with the docker daemon as it requires a Linux kernel which was not introduced in WSL 1. I hold my series of posts on Custom Vision to add another brain reminder, this one is Do not install Windows 10 Home if you are going to use Docker! I recently installed a new dev environment, and when I was going to install Docker Desktop I found this amazing message Docker Desktop.

Have you previously installed Docker Toolbox, Docker Machine, or VirtualBox?

Docker for Windows now requires Microsoft’s Hyper-V. Once enabled, VirtualBox will no longer be able to run virtual machines (your VM images will still remain). You can still use docker-machine to manage remote hosts.

You have the option to import the default VM after installing Docker for Windows from the Settings menu in the System Tray.

Docker for Windows enables Hyper-V if necessary; this requires a reboot.

Requirements

Docker for Windows runs on 64-bit Windows 10 Pro, Enterprise, and Education; 1511 November update, Build 10586 or later. Docker plans to support more versions of Windows 10 in the future.

Installation

Home
  1. Download Docker.
  2. Double-click InstallDocker.msi to run the installer.
  3. Follow the Install Wizard: accept the license, authorize the installer, and proceed with the install.
  4. Click Finish to launch Docker.
  5. Docker starts automatically.
  6. Docker loads a “Welcome” window giving you tips and access to the Docker documentation.

That’s it!

Verification

The whale in the status bar indicates a running (and accessible via terminal) Docker instance.

Open PowerShell or your favorite Windows terminal (e.g., Command prompt) and enter docker run hello-world.

Windows prompts you for access every time Docker starts, allowing Docker to manage the Hyper-V VM’s. The first time Docker starts, you may need to provide the token from the Beta invitation email. When initialization completes, select About Docker from the notification area and verify you have the latest version.

From PowerShell (or your favorite Windows terminal), check the versions of docker, docker-compose, and verify your installation:

Before you stop, let’s test a Dockerized webserver; from PowerShell or cmd.exe, run:

If your host does not already have it, Docker downloads nginx from Docker Hub and starts it. As soon as the download completes, point your web browser to http://docker to view the start page. You should see:

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.Commercial support is available at nginx.com.

Thank you for using nginx.

Common Pitfalls

CPU

If your CPU does not support virtualization, or if you do not have a 64-bit CPU, you cannot run Docker locally.

Operating System

If you do not run a 64-bit version of Windows Windows 10 Pro, Enterprise, or Education; 1511 November update, Build 10586 or later, you cannot run Docker for Windows.

Docker

You can install Docker Toolbox if you have a 64-bit version of Windows 7 or later. Alternately, you do have the option to upgrade.

Next: Install Docker on Linux
Requirements and things to know before installing Docker for Linux.

Have you ever faced cannot connect to the docker daemon at unix:///var/run/docker.sock. is the docker daemon running? on Windows / WSL? This means you've installed only docker CLI, but docker daemon is still not working.

Windows Subsystem for Linux is a Linux environment that could be installed on Windows 10 machines and then could be used to run Linux binaries. But WSL 1 was too limited to be compatible with the docker daemon as it requires a Linux kernel which was not introduced in WSL 1.

WSL 2 is a brand new environment that supports easy integration with docker host mode because it has a Linux kernel inside. In other words, you don't need stand-alone virtual machines like Virtualbox or VMware and complex setup guides to run docker anymore, docker will work natively here 😊

To install WSL 2 on your Windows 10 Home (or Windows 10 Pro) use this simple WSL 2 setup guide. Before installing docker work then, carefully execute all steps.

Installing Docker on Windows

Get the Docker from the official docker website and install it:

Start Docker Desktop from Start menu.

Go to Settings -> Resources -> WSL Integration. If you had WSL 1 distribution before WSL 2, it might show you You don't have any WSL 2 distro...:

How to fix 'You don't have any WSL 2 distro'

Now configure your WSL distribution to run WSL version 2 (I had 1 by default).

To check the current version, just run in cmd:

It will show:

Ignore docker distributions. The first line holds your real distribution. To set version 2 I executed :

Where Ubuntu-18.04 is the distro name from wsl -l -v command. It takes a few minutes😐, but don't close the terminal.

When it is finished, click Refresh.

Now hit Apply and Restart 💪:

Enable WSL 2 integration

All is simple, just find your distribution (Ubuntu-18.04 in my case, and turn on the switch)

Try it

Run your distro terminal from the start menu:

Now execute 🚀

Windows

And open https://localhost/ then:

Congratulations, it is working🎉

What should you do if you 'cannot connect to the Docker daemon'

If you are receiving some sort of:

  • cannot connect to the Docker daemon at unix:///var/run/docker.sock. is the docker daemon running?
  • couldn't connect to docker daemon at http+docker://localhost - is it running?
  • cannot connect to the Docker daemon
  • error: couldn't connect to docker daemon at http+docker://localhost - is it running?

Then it means that the docker daemon not running, so please make sure that your docker daemon is running.

Can I Run Docker On Windows 10 Home

If you would be on non-WSL Linux, you should do:

The difference is that on Windows WSL 2, that you should still visit Docker Desktop from the Start menu to make sure the daemon is working.

Important advices

How To Run Docker On Windows 10 Home Edition

If you just updated from WSL 1 to WSL 2 or just installed WSL 2 I strongly recommend reading our WSL 2 starter must-read, it has an explanation of super-popular problems and tips which you will most probably face if you are new to WSL 2. In short, docker usage tips consequently flow from the starter guide:

How To Run Docker On Windows 10 Home

  • Please store all sources and volumes inside of the Linux filesystem in WSL. (I.e. Paths from $HOME/..., or ~/...). For example, docker run -v ~/proj:/sources <my-image> is ok when docker run -v /mnt/c/users/kenny/proj/sources <my-image> might have a much worthier performance
  • Use WSL Remote extension for Visual Studio Code