RobDWaller A Developer

Bio

Rob Waller Profile Picture

I am a software developer and manager with nearly a decade and a half of experience. I also built Twitter's largest anti-bot app.

View My GitHub Profile

Tweet Me: @RobDWaller

Setup Docker with Ubuntu Windows Subsystem for Linux

November 07, 2019 Home > Blogs > Setup Docker with Ubuntu Windows Subsystem for Linux Author: Rob Waller Tags: docker, windows, wsl, linux, ubuntu

I’m a big fan of Windows Subsystem for Linux because I hate the Windows command prompt. WSL allows me to run Ubuntu on Windows and get a mix of the benefits that both Linux and Windows offer.

One problem though I found recently was using Docker on Windows. First you need to make sure you are running Windows Pro, Home will not suffice. But importantly for me you can’t install Docker for Windows and access it directly from WSL in your Ubuntu terminal.

This is a bit of a pain but it turns out there is a solution. You can create a npiperelay… I have no idea what this is exactly but it will allow WSL to communicate with Docker for Windows. The tutorial is on the Microsoft Tech Blog and it is relatively straight forward to follow.

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 in to the daemon running under Windows from WSL. What does this let you do? You can create dockerfiles, build them, and run them in the daemon—Windows or Linux, depending on which runtime you have selected—all from the comfort of WSL.

I’ve done this on two machines now and it works fine and gives you full control over Docker, just like you were executing the commands on a Linux environment or via Windows Power Shell.

Hopefully Microsoft will improve WSL over the coming months and years so that this is no longer an issue. But for now this seems to be a decent work around. I hope it helps.