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
- Install Docker on Windows.
- Expose Docker on Windows to the WSL.
Windows Subsystem for Linux (WSL) Steps
- Remove all previous docker installations.
- Install Docker with a single-line command.
- Update and upgrade.
- Set an environmental variable.
- 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.
$ sudo vim ~/.profile
- Add
export DOCKER_HOST=tcp://0.0.0.0:2375
to the file. - 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