You can use Docker Desktop for Windows as the engine and Docker for Linux as the client in WSL on Ubuntu / Debian on Windows. Connect them via TCP.
Install Docker Desktop for Windows: https://hub.docker.com/editions/community/docker-ce-desktop-windows
If you want to use Windows Containers instead of Linux Containers both type containers can be managed by the Linux docker client in the bash userspace.
Since version 17.03.1-ce-win12 (12058) you must check Expose daemon on tcp://localhost:2375 without TLS to allow the Linux Docker client to continue communicating with the Windows Docker daemon by TCP
Follow these steps:
wget https://download.docker.com/linux/static/stable/`uname -m`/docker-19.03.1.tgz
tar -xzvf docker-*.tgz
./docker -H tcp://0.0.0.0:2375 ps
env DOCKER_HOST=tcp://0.0.0.0:2375 ./docker ps
To make it permanent:
mv ~/docker/docker ~/bin
Add the corresponding variables to .bashrc
Of course, you can install docker-compose
curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
Or using python pip
sudo apt-get install python-pip bash-completion
sudo pip install docker-compose
And Bash completion. The best part:
apt-get install bash-completion
curl -L https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker > /etc/bash_completion.d/docker
curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose
I've tested it using the 220.127.116.11 (37199) version of Docker Desktop using Hyper-V:
$ docker version
Client: Docker Engine - Community
API version: 1.40
Go version: go1.12.5
Git commit: 74b1e89e8a
Built: Thu Jul 25 21:17:37 2019
Server: Docker Engine - Community
API version: 1.40 (minimum version 1.12)
Go version: go1.12.5
Git commit: 74b1e89
Built: Thu Jul 25 21:17:52 2019
Look both client and server say **OS/Arch: linux/amd64**
Take care when adding volumes. The path
C:\dir will be visible as
/mnt/c/dir on WSL and as
/c/dir/ by docker engine. You can overcome it permanently:
sudo bash -c "echo -e '[automount] \nroot = /'>/etc/wsl.conf"
You must exit and reload WSL after making the change to wsl.conf so that WSL reads in your changes on launch.
from: What’s new for the Command Line in Windows 10 version 1803
Unix Sockets weren't supported on Windows, and now they are! You can also communicate over Unix sockets between Windows and WSL. One of the great things about this is it enables WSL to run the Linux Docker Client to interact with the Docker Daemon running on Windows.
This script and the use of Unix Sockets was included in Pengwin's pengwin-setup.
bashuserspace. It's a real, fairly complete Linux userspace, but without X Windows i.e. text only. Saying "bash" communicates the text-only limitation quite well..