In the recent years since Microsoft released WSL a few good stories have popped up on how to set up and manage WSL permissions, in particular when it comes to using WSL alongside Docker for Windows.
Why use Windows, you say? You have to realize that while a lot of engineering folk prefer to use OS X, most of the Business Analysts, corporate, and offshore engineers run on Windows. Most of the companies I’ve worked in the last decade have some sort of offshore engineering support, some for QA, others for straight-up engineering.
As a tools-person, part of my sales pitch as a hire is in having the ability to create and maintain bespoke development solutions for both Mac and Windows folk.
Therefore every year or two I switch back and forth from doing most of my development work from one operating system to the other. Sometimes I’m maintaining tooling for both OS’es at once.
And that brings me to this post about WSL — or Windows Subsystem for Linux. Here I will document for my future self and anyone else that needs further reference what my current setup for WSL looks like, as well as the bibliography that I’ve used myself as reference.
Set Up Docker For Windows and Ubuntu WSL
Once Docker for Windows is installed, expose the Docker daemon port to localhost so that the Docker Client running on WSL can access it:
After installing and setting up Docker for Windows you can download and install Ubuntu for WSL from the Microsoft Store:
Set up Ubuntu on WSL
Nick Janetakis gets the credit for the story that I have kept reliably going back to set up WSL whenever I’ve needed to, such as when I install a new version of Ubuntu on WSL:
Setting Up Docker for Windows and WSL to Work Flawlessly
Quick Jump: Configure Docker for Windows (Docker Desktop) | Install Docker and Docker Compose within WSL | Configure…
In case Nick’s blog is lost to time for any reason, I have captured his WSL install instructions in a public gist for backup:
Here are the current contents of my
As Nick notes in his story, if you’re running lower than Windows 10 18.03, you might need to follow slightly different instructions — and he covers those as well.
Here is the
.profile inside WSL:
Fixing the WSL mounts
/etc/wsl.conf, the default mount is changed from
/drive . This is because, quoting Nick:
When using WSL, Docker for Windows expects you to supply your volume paths in a format that matches this:
But, WSL doesn’t work like that. Instead, it uses the
This should address compatibility between Docker for Windows and WSL.
As for the
777 permissions showing up everywhere inside WSL by default, the official documentation by Windows addresses how to fix that using
/etc/wsl.conf , which I’ve already included in the
wsl.conf I put above.
It seems that even with the file mask settings placed in
wsl.conf , file masks might still be broken inside WSL, so that’s where the
.profile bit comes in.
- Nick Janetakis: Setting Up Docker for Windows and WSL to Work Flawlessly
- Microsoft: Manage and configure Windows Subsystem for Linux
- Stack Overflow: Docker on WSL Wont Bind