Script who will free you to keep using Windows with WSL without Docker Desktop!
- SO Linux Ubuntu/Debian
- Advanced Package Tool (Apt) Install Manager
Tested on WSL2 using Ubuntu 18.04/20.04/21.04 distros
The 'docker-install.sh' is a script based on Docker documentation https://docs.docker.com/engine/install/ubuntu/, for a clean and direct installation on a Linux instance, without the dependency of Docker Desktop, less network traffic outside of WSL and reduce processing resource use.
Important to be aware, this script will remove old Docker installations as Docker Engine and oldest docker.io, as terraform to new installations, preventing incompatibilities issues. If you want a interface and easy management, keep using the Docker Desktop with WSL integration.
It's recommended you to shutdown the Docker Desktop before run this script.
Must elevated permission as root or sudo (the current user must in the sudoers list), in order to remove and install dependencies.
Two options for get and run this script:
curl -s https://raw.githubusercontent.com/hfisaquiel/wsl-docker-install/main/docker-install.sh | sudo sh
Download the file docker-install.sh or clone this repository and execute the docker-install.sh
file using SH
or Bash
.
sudo sh docker-install.sh
In some moments, the script can ask you to confirm due overwrite the previous localy saved GPG key. You can overwrite (recomended) or put a new name path for file.
Restart the WSL (or the machine itself) after installation complete. This command must be run on Windows command
cmd.exe
orPowerShell
wsl --shutdown && wsl
Maybe additional steps must be necessary if issues like permissions or network fail. You can read about at Docker post-installation page.
sudo groupadd docker
sudo usermod -aG docker $USER
If you see error like:
# WARNING: Error loading config file: /home/user/.docker/config.json -
Than change permission to .docker
folder
sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R
if you experience some network problems as like "host unreachable", add/edit the /etc/docker/daemon.json
file and save as root/sudo user, add the dns
configuration:
{
"dns": ["8.8.8.8", "8.8.4.4"]
}
This are Google DNS resolver, you are free to use another, if work for you.
Logout or restart the WSL using cmd.exe
or PowerShell
wsl --shutdown && wsl
If this script doesn't resolve your problem, you can open a issue or use a docker automated script on https://github.com/docker/docker-install.
Open a issue or contribute with this repo opening a new PR.