Skip to content

Instantly share code, notes, and snippets.

@brosahay
Last active March 26, 2022 19:16
Show Gist options
  • Save brosahay/c2cdbe38dff28d7a9432330962111d9c to your computer and use it in GitHub Desktop.
Save brosahay/c2cdbe38dff28d7a9432330962111d9c to your computer and use it in GitHub Desktop.
Docker on Ubuntu 20.04 LTS WSL
#!/bin/bash
# Install Docker-CE
sudo apt update -y
sudo apt install docker-compose -y
# Add User to Group
sudo groupadd docker
sudo gpasswd -a $USER docker
newgrp docker
# Connect to Docker in running on native Windows
# Enable option Expose daemon on tcp://localhost:2375 without TLS
echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bashrc && source ~/.bashrc
## CHECK INSTALL
# docker info
# docker-compose -version
# /etc/wsl.conf for Windows 18.03+
# mounts at /c or /e instead of /mnt/c or /mnt/e.
[automount]
root = /
options = "metadata"
@just-digital
Copy link

This works like a charm! Thank you @brosahay

@brosahay
Copy link
Author

Skipping Line#14
and adding the following option instead of exposing the daemon on tcp://localhost:2375 is working now. Tested it with Ubuntu 20.04 LTS on WSL2 (Windows 10).

Screenshot 2022-03-23 12 12 06

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