Docker in WSL¶
Since Docker Desktop for Windows cannot be installed anymore on corporate laptops, due to the new Community & Enterprise editions of Docker, here's the workaround to have Docker in your Windows mahcine, installed under the Windows Subsystem For Linux (WSL).
Prerequisites¶
- Turn on required features on Windows such as Hyper-V, virtualization and the Windows Subsystem for Linux.
- Install the Debian distro from the Microsoft Store (preferred, as other distro such as Ubuntu may have some issues during the Docker installation).
- Once installed, open Debian terminal and follow the steps to setup your root username and password. Recommended: As you will need sudo quite often, set a simple remindable password, like a PIN, which is different from the dynamic CORP passsword.
Install Docker on WSL¶
- In case you just installed Debian, first restart the terminal.
- Follow step-by-step the official installation guide for Docker Engine (not Desktop) on Debian.
- Restart the terminal.
- Start Docker with one of the following commands:
- Start using daemon:
- Start using service:
- Start using daemon:
- Once started, completely close the terminal session without running Ctrl+C out of the command. Docker service will still run in the background.
- Open the terminal and run
docker ps
to check if Docker is running. - Add your user to the Docker group to run Docker commands as sudo:
Troubleshoot¶
Docker daemon failed to start due to iptables¶
Debian may change the WSL iptables definition and Docker may have failed during start up.
In order to fix this issue, run the following commands as recommended workaround by the community to restore the legacy iptables:
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
Now try starting Docker daemon again as described in the installation steps above.
Reinstall Docker Compose plugin latest version¶
For some specific Docker Compose modules, such as Docker on Azure ACI integration, you may need to reinstall the Docker Compose plugin:
- Uninstall the current Docker Compose Plugin.
- Install the Docker Compose CLI following this guide, or with the following automatic installation command:
- Restart the terminal.
- Re-install the Docker Compose Plugin:
For Docker Azure integration, try to login using a service principal (App Registration):