Skip to content

Instantly share code, notes, and snippets.

@sgtoj
Last active January 22, 2021 15:44
Show Gist options
  • Save sgtoj/129a057e492b8d8f832964b7b73c6c57 to your computer and use it in GitHub Desktop.
Save sgtoj/129a057e492b8d8f832964b7b73c6c57 to your computer and use it in GitHub Desktop.
Ubuntu for Windows: Setup Docker for WSL
# install docker client
curl https://download.docker.com/linux/static/stable/x86_64/docker-19.03.8.tgz > ~/docker.tar.gz
tar xzvf ~/docker.tar.gz --directory ~/
sudo mv ~/docker/docker /usr/local/bin/docker
rm -rf ~/docker
rm -f ~/docker.tar.gz
# install docker-compose client
curl -L https://github.com/docker/compose/releases/download/1.28.0/docker-compose-Linux-x86_64 > ~/docker-compose
chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
# point client to docker engine running in windows
echo "DOCKER_HOST=tcp://127.0.0.1:2375 ; export DOCKER_HOST" >> ~/.bashrc
source ~/.bashrc
# test clients
docker --version
docker-compose --version
@sgtoj
Copy link
Author

sgtoj commented Oct 5, 2017

Native Docker (i.e. Docker Engine) is not compatible with WSL. However, The Docker client and Docker Compose (v1.17.1) client can be installed and configured connect to Docker for Windows. To do so, install Docker for Windows then follow the instructions then close all BASH instances and relaunch.

After installing the client, expose the TCP port in the Docker for Windows setting. See screenshot...

Expose TCP in Docker Settings

@sgtoj
Copy link
Author

sgtoj commented Nov 3, 2020

This is no longer needed with latest version of docker for windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment