Last active
September 14, 2022 06:56
-
-
Save mrevjd/ad99c67889404a303c8d2ea2864bfa40 to your computer and use it in GitHub Desktop.
Install docker CE on WSL 2 UB 22.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt -y remove docker docker-engine docker.io containerd runc | |
| sudo apt update | |
| sudo apt -y install \ | |
| ca-certificates \ | |
| curl \ | |
| gnupg \ | |
| lsb-release | |
| sudo mkdir -p /etc/apt/keyrings | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
| echo \ | |
| "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ | |
| $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
| sudo apt -y update | |
| sudo apt -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin | |
| sudo usermod -aG docker $USER | |
| sudo curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
| sudo chmod +x /usr/local/bin/docker-compose | |
| sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose | |
| # Docker daemon specification | |
| visudo | |
| # Add the below without the # | |
| # %docker ALL=(ALL) NOPASSWD: /usr/bin/dockerd | |
| # Start Docker daemon automatically when logging in if not running. | |
| # Put this in .bashrc | |
| if [ -f "/usr/bin/dockerd" ]; then | |
| if ! pidof dockerd >/dev/null; then | |
| sudo dockerd > /dev/null 2>&1 & | |
| disown | |
| fi | |
| fi | |
| # Fix iptables issue on UB 22.04 | |
| sudo update-alternatives --set iptables /usr/sbin/iptables-legacy | |
| sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment