Configure Docker Client on Linux with Docker Daemon on Win 10


The purpose of this post is to show you how you could configure a docker client within a Linux distro (Ubuntu in this case) installed on top of the Windows Subsystem for Linux (WSL), and connect it with the docker daemon within the docker engine installed/running locally on your host Windows 10 machine.

Let’s start with a brief Introduction of the surrounding concepts and context:

The Windows Subsystem for Linux (WSL) lets developers run Linux environments, including most command-line tools, utilities, and applications directly on Windows, unmodified, without the overhead of a virtual machine.

Microsoft introduced WSL with Windows 10 build 1607 (Anniversary Update). Initially, Microsoft made a Ubuntu user-mode Image available on top of the WSL, and it was called “Bash on Ubuntu on Windows”. During the Install process, a Ubnutu use-mode image would be downloaded/extracted locally, and you could then launch a Ubuntu shell from within your Windows command prompt.

However, with Windows 10 Fall Creators Update, Microsoft has Introduced multiple Linux distros besides Ubuntu (OpenSuse Leap 42, Suse Linux Enterprise, and more to come) available and packaged in the form of Apps in the Microsoft Store. Now you can choose one or more available Linux distro Apps, and Install them side-by-side like you would any other Store Apps. Thereafter, you could access each of the Installed Linux distros from their respective shells.

I am assuming that you are on Windows 10 Fall Creators Update, and have “Docker for Windows” already Installed on your Win 10 machine. If not, you need to have the same setup to try out Instructions given in this post.

For earlier Windows 10 builds like Anniversary Edition or Creators Update, steps would change accordingly. Refer to details here: Install Linux Subsystem on Windows 10

Install and Configure Ubuntu App from Microsoft Store:

  • Go to the Microsoft Store on your Win 10 machine
  • Search for Ubuntu App
  • Install the Ubuntu App

Ubuntu on WSL App

  • Once Installed, start the Ubuntu App
  • On first start, Ubuntu App will show you the terminal for Ubuntu Shell, asking you about License acceptance, and setup your Linux username/password.
  • After completing above step, you are all set to proceed forward

Install Docker Client on Ubuntu on WSL:

Execute following commands in sequence within Ubuntu on WSL Shell:

Enable Docker Client within Ubuntu on WSL to Connect with Docker Daemon on Host Windows 10 Machine:

This step depends on how the Docker engine is setup on your Win 10 machine.

In our case, because we are using “Docker for Windows” to run the Docker engine on Win 10, we need to make following changes on the Win 10 machine:

  • Start “Docker for Windows” if not already started (i.e. if you disabled its automatic startup on boot)
  • Open “Docker for Windows” settings on your Win 10 machine
  • Enable the “Expose daemon on tcp://localhost:2375 without TLS” option

Docker CE Settings

Configure ~/.bashrc file in Ubuntu on WSL:

Next, we need to make a change in our ~/.bashrc file within Ubuntu on WSL so that our Docker client can connect to the docker daemon on our Win 10 machine:

  • Open the Ubuntu on WSL Shell
  • Add the following line to the end of the ~/.bashrc file, and save the file
    export DOCKER_HOST=tcp://

Test the Setup:

  • Close the Ubuntu on WSL terminal and Reopen
  • Issue command: docker ps

You should see an output showing all the currently running containers

Hope you found this blog post useful. If you have any queries/feedback, please feel free to mention in the comments section below.


Be the first to comment

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.