How to start "Native Docker" on Windows with WSL2… today!

Short Version

Start using "native" docker on Windows today, even on Windows 10 Home! Go to github/LongLiveCHIEF/wsl2-docker-for-win for installation, configuration, and usage.

Give it a shot and open issues in the project or comment here if you have any problems! Contributions welcome!

Long Version

Lately, the fatigue of dual-booting between Windows and Linux has been getting to me. In my day job, I'm a docker fanatic and Linux fanboy. On my R&R time, I've been getting involved with IoT and making. The electronics programming side of thing is far smoother on Linux than on Windows, but when it comes time to 3D print, all the design and printing software is Windows.

I challenged myself recently to trying to use WSL2 as a solution for only needing to boot one OS on hardware, and get a seamless/native "One OS to rule them all" seamless/native experience.

On Friday, I achieved the first level of mastery when I stumbled across release notes for Windows Insider Preview 1945, and specifically noticed that WSL2 now transparently binds ports from WSL processes and windows.

I'd already been looking forward to Docker's WSL2 Tech Preview since their announcement in July, especially since WSL2 runs on Windows 10 Home!

I began to wonder if I could find a way to install the native docker for-windows client and setup the WSL2 as the daemon, and it worked! It worked beautifully! Not only that, but I soon discovered that thanks to the new Windows Terminal, I actually could get the "native" docker experience on windows without even installing docker on Windows itself!

I've explained and documented everything in further detail, both with and without the native windows docker cli installed, in my project at github/LongLiveCHIEF/wsl2-docker-for-win.

Some Thoughts on Windows + Docker + WSL2

I think this solution has the potential to provide some advantages even over the eventual docker for windows using WSL2. You can download the Docker WSL2 Tech Preview and compare for yourself if you want. This solution and the WSL2 docker for windows that is coming are basically the same thing under the hood. With the docker desktop solution, you'll get the taskbar icon and settings editor app, and the ability to switch contexts (which may go away eventually), but that's about it.

The only real difference at the moment is that I'm guessing the WSL2 tech preview will autostart the docker daemon in WSL, and will also modify the daemon -H listener by identifying the IP address of the Windows host from the Linux host. Either that, or it will auto-generate certs and use a TLS connection for the windows docker-cli.

However, if you read the usage section of my doc, you'll see that you can you can get the native experience without using the docker-cli compiled for Windows at all.

I might add in an auto-cert generation feature to my project, along with a streamlined powershell module to automate my config/install steps anyways. Subscribe, fork, or submit PR's if you'd like to stay up to date or contribute for that.

Plans for my project and misc info

I plan (no guarantee's), on writing a PowerShell module that will allow you to check the configuration of Windows/WSL, enable and install WSL2 and Ubuntu 18.04, and auto configure said distro using the /etc/wsl.conf settings described in the project.

I plan to even make this work if you're behind a company firewall and use an internal proxy filter/mirror.

I also have opened an issue at github/docker/for-win to update their WSL2 tech preview to allow Windows 10 Home SKU's to install docker-for-windows if you are on build 18945+.

Edit: Fixed June -> July for the Docker WSL2 announcement, and added the Plans and misc info details

submitted by /u/LongLiveCHIEF
[link] [comments]
Source: Reddit