WSL Tips: Using Docking for Windows inside Bash

This tip is actually really easy, because everything works mostly the right way already. You just need to get the Windows docker command executable from inside Bash. This tip is less “how to do this thing?” and more “you can do this thing!”

First, if you haven’t already, you should go install Docker for Windows, of course.

The installer will let you chose between “Linux Containers” and “Windows Containers” and if you’ll want to select Linux. After the install is done, it will prompt a reboot. Depending on your existing system settings (if you haven’t got Hyper-V already enabled) it might require two reboots.

Simple setup an alias in your .bash_profile  to easily invoke the docker client.

And… that’s pretty much it. You can now invoke Docker from both Windows and Linux shells interacting weith the same sets of downloaded images and running containers. The interoperability is pretty transparent. As an example, here’s a snapshot of my experiment grabbing a Postgres image from the Windows side and running it from the Linux side:

Leave a Reply

Your email address will not be published. Required fields are marked *