Linux – Does the WSL from Windows 10 Spring update (2018) allows me to run docker on it? and why

dockerwindowswindows 10windows-subsystem-for-linux

I heard that "Windows 10 Spring Update Bringing WSL Unix Sockets Support".

Before, I was unable to run docker service into a WSL due a socket error.

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Does the new WLS spring update feature is enough to run docker on WSL?

Best Answer

Does the new WLS spring update feature is enough to run Docker on WSL?

Microsoft does not support running the Docker daemon (also known as the service) within the WSL instance.

We frequently get asked about running docker from within the Windows Subsystem for Linux (WSL). We don’t support running the docker daemon directly in WSL. But what you can do is call into the daemon running under Windows from WSL. What does this let you do? You can create docker files, build them, and run them in the daemon—Windows or Linux, depending on which runtime you have selected—all from the comfort of WSL.

[Cross Post] WSL Interoperability with Docker

The Docker daemon can't run under WSL as it doesn't implement the necessary kernel ABI's. If you're running Docker for Windows, you are probably connecting to the Hyper-V virtual machine that it manages.

Is Docker running within WSL or connecting back to Windows?

While the daemon cannot run within a WSL instance, you can use the Docker CLI, to connect to a Docker service running on your Windows installation.

In the general settings, you’ll want to expose the daemon without TLS. This step is necessary so that the daemon listens on a TCP endpoint. If you don’t do this then you won’t be able to connect from WSL.

enter image description here

We still need to install Docker inside WSL because it’ll give us access to the > Docker CLI. We just won’t bother starting the server.

The following instructions are for Ubuntu but with the 2017 fall update+ of Windows, WSL now supports a variety of distributions so if you happen to use something other than Ubuntu then follow the Docker installation guide for your distro from Docker’s installation docs.

This will install the edge channel, change ‘edge’ to ‘stable’ if you want. You may also want to update the Docker Compose version based on the latest release.

# Environment variables you need to set so you don't have to edit the script below.
export DOCKER_CHANNEL=edge

# Update the apt package index.
sudo apt-get update

# Install packages to allow apt to use a repository over HTTPS.
sudo apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \

# Add Docker's official GPG key.
curl -fsSL | sudo apt-key add -

# Verify the fingerprint.
sudo apt-key fingerprint 0EBFCD88

# Pick the release channel.
sudo add-apt-repository \
   "deb [arch=amd64] \
   $(lsb_release -cs) \

# Update the apt package index.
sudo apt-get update

# Install the latest version of Docker CE.
sudo apt-get install -y docker-ce

# Allow your user to access the Docker CLI without needing root.
sudo usermod -aG docker $USER

# Install Docker Compose.
sudo curl -L${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose &&
sudo chmod +x /usr/local/bin/docker-compose

First up, open a WSL terminal because we need to run a few commands.

Create and modify the new WSL configuration file:

sudo nano /etc/wsl.conf

# Now make it look like this and save the file when you're done:
root = /
options = "metadata"

If you get an error the next time you start your WSL terminal don’t freak out. It’s a bug with 18.03 and you can easily fix it. Hit CTRL+Shift+ECS to open task manager, goto the “Services” tab, find the “LxssManager” service and restart it.

Setting Up Docker for Windows and WSL to Work Flawlessly