In order to work entirely in bash, we installed Docker in the Windows Subsystem for Linux (WSL).

The official Ubuntu installation instructions did not work for us. There were too many problems to productively list here.

Here are the steps that worked.

Windows Steps

  1. Install Docker on Windows.
  2. Expose Docker on Windows to the WSL.

Windows Subsystem for Linux (WSL) Steps

  1. Remove all previous docker installations.
  2. Install Docker with a single-line command.
  3. Update and upgrade.
  4. Set an environmental variable.
  5. Connect.

Windows Steps

Install Docker on Windows

This Reddit post explained the need to install Docker for Windows. The official documentation links to the official installer. That is what we used.

Expose Docker on Windows to WSL

After installing Docker on Windows, we exposed it without TLS. This lets the Docker command line on Linux connect to the Docker Daemon on Windows.

Windows Subsystem for Linux (WSL) Steps

The remaining steps happen in the WSL bash shell.

Remove all previous docker installations

$ sudo apt-get purge docker docker.io docker-ce

Install Docker with a single-line command

$ sudo curl -sSL https://get.docker.com/ | sh

Update and upgrade

$ sudo apt-get update
$ sudo apt-get upgrade

Set an environmental variable

We used vim to set this permanently in our ~/.bashrc file.

  1. $ sudo vim ~/.profile
  2. Add export DOCKER_HOST=tcp://0.0.0.0:2375 to the file.
  3. Save and close Vim with :wq

Note: .profile is loaded at session start and modifications are not usable before you reload it: source ~/.profile (Credit @cog_g).

Connect

$ docker info
$ docker run hello-world