Craftsman at work

I'm Artur Karbone, coding software architect and independent IT consultant and this is my blog about craftsmanship, architecture, distributed systems, management and much more.

Docker: Launching from WSL (Windows Subsystem for Linux)

At the moment it's not possible to run docker daemon in WSL. However, you can leverage the daemon installed in the host system. And use the WSL as a client.

The prerequisite is that daemon on the host machine exposes port 2375.

Now let's use the WSL as a client. A couple of ways to do that:

docker -H localhost:2375 images


export DOCKER_HOST=localhost:2375

With this environment variable it is no more necessary to use -H option explicitly

docker images

In order not to miss the variable after bash restarts, just append variable assignment to the .bash_profile:

echo "export DOCKER_HOST=localhost:2375" >> ~/.bash_profile

Find more details here.

comments powered by Disqus