Installing Docker on Ubuntu/Pop!_OS 22.04
In a previous article, we discussed the containerization platform Docker, its benefits, and how it has transformed software deployment and management. Now that you have a better understanding of Docker and its advantages in your homelab, it’s time to delve into the installation process. In this article, we will provide a step-by-step guide on installing Docker on Ubuntu 22.04 or Pop!_OS 22.04, enabling you to harness the power of containerization and streamline your application deployment.
Step 1: Ensure your system is up to date:
sudo apt update -y && sudo apt upgrade -y
Step 2: Remove any old Docker versions (if you have none installed, apt will return that there are no packages to remove):
sudo apt remove docker docker-engine docker.io containerd runc
Step 3: Setup the apt repository:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Step 4: Install
sudo apt update -y
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Step 5: Verify Functionality:
sudo docker run hello-world
The above command should return a confirmation message that Docker is installed and running
Running docker without sudo
If you get an error every time you try to run docker without sudo, it’s because you need to add your user to the docker group. The following command will add your user to the docker group:
sudo usermod -aG docker $USER
Run the following command to activate the changes to the group:
newgrp docker
Verify Functionality without sudo permissions:
docker run hello-world
Conclusion
With this step-by-step guide, installing Docker has never been easier. By following these instructions, you’ll be well-equipped to take advantage of the powerful containerization platform and reap the benefits discussed in our previous article. Once you have successfully installed Docker, you can begin exploring the vast array of pre-built images and templates available, and enjoy the simplicity and efficiency it brings to your homelab. Stay tuned for articles on utilizing docker to run self-hosted services in your homelab. Happy containerizing!