Install Docker on Linux
🐋

Install Docker on Linux

Author
André Arruda
Tags
Software Development
Docker
Slug
install-docker-on-linux
Published
Feb 1, 2023
Tag
Option 1

Uninstall

sudo rm -rf /var/lib/containerd/
sudo rm -rf /var/lib/docker/
sudo apt-get purge -y docker-ce docker-ce-cli docker.io containerd.io
sudo apt-get install docker.io
 

Update

sudo apt update
sudo apt upgrade
sudo apt install ca-certificates curl gnupg lsb-release
 

Download the GPG key of the Docker from its website and add it to the repository of Pop!_OS:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
 

Add the stable repository of the dockers from its website to the repository of Pop!_OS:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu   $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt update
 

Install the latest version of Dockers on Pop!_OS:

sudo apt install docker-ce docker-ce-cli containerd.io -y
 
After the complete installation of the Docker, we will check its status using the command:
sudo systemctl status docker
docker --version

Install docker-compose

sudo apt install docker-compose -y

docker-compose --version
 

Add group permissions

sudo groupadd docker
sudo gpasswd -a $USER docker
sudo apt-get install acl
sudo setfacl -m user:$USER:rw /var/run/docker.sock
Test a container example
docker run hello-world