How to Install Docker on Pop!_OS 22.04: A Step-by-Step Guide

Need to install Docker on Pop!_OS 22.04 LTS? Our guide covers the installation process step by step for a hassle-free setup.

If you’re venturing into the world of containerization and looking for an efficient way to deploy applications, Docker is the tool you need. But what’s better than harnessing the power of containerization on a distro that’s an absolute joy to use?

Now, whyย Pop!_OS? Developed by System76, it is a Linux distribution based onย Ubuntu, specifically designed to meet all desktop computing needs while providing a beautiful and efficient user interface.

It has quickly become renowned for its strong, user-friendly approach, rich software repositories, and robust performance, delivering a seamless experience that leverages the best of Linuxโ€™s ecosystem.

Now, to the subject. Installing Docker on Pop!_OS 22.04 LTS is a straightforward process. This guide is tailored to help you achieve a smooth setup and kickstart your Docker journey on a platform that champions efficiency and ease of use. So, let’s dive in!

Installing Docker on Pop!_OS 22.04 LTS

You can install Docker on your Pop!_OS 22.04 system in several ways. For example, it is available in the official distro’s repositories, where it can be easily installed with a single APT command. However, one disadvantage to this approach is that the version available is not always the most recent.

For this reason, this guide will show you how to install Docker on Pop!_OS 22.04 from the official Docker repository, where you always get the latest up-to-date version and will automatically receive all future software updates as they become available.

Step 1: Uninstall (If Any) Conflicting Packages

You can bypass this step if you’re confident that Docker has never been installed on your Pop!_OS 22.04. However, if there’s any chance Docker might have been previously installed, it’s strongly advised to execute the following command.

This step ensures the removal of any existing “docker,” “containerd,” and “runc” packages from your system, preventing potential conflicts with the installation process outlined below.

So, open the Terminal app and run the following:

for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; doneCode language: JavaScript (javascript)

Step 2: Install Prerequisites

In this step, we’re going to install several extra packages. While these are not part of Docker’s core functionality, they must be available on your Pop!_OS 22.04 system as they are needed to import the official Docker repository smoothly into your system (described in the following steps).

sudo apt install apt-transport-https ca-certificates curl

Step 3: Add Dockerโ€™s GPG Repo Key

Next, we must import the Docker GPG repository key. This security feature ensures that the software youโ€™re installing is authentic.

sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.ascCode language: JavaScript (javascript)
Add Dockerโ€™s GPG repo key.

Notice that the command produces no output.

Step 4: Add the Docker Repo to Pop!_OS 22.04

After importing the GPG keys, weโ€™ll add the official Docker repository to our Pop!_OS 22.04 system. This implies that the update package will be made available with the rest of your systemโ€™s regular updates when a new version is released.

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/nullCode language: PHP (php)
Add the official Docker repository to Pop!_OS 22.04.
Add the official Docker repository to Pop!_OS 22.04.

As with the previous command, its execution produces no output. Next, refresh the package list.

sudo apt update
Refresh the package base.
Refresh the package base.

As you can see, our newly added Docker repository is now available and ready to be used.

Step 5: Install Docker on Pop!_OS 22.04 LTS

To install the latest up-to-date Docker release on your Pop!_OS 22.04 system, run the below command.

sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginCode language: CSS (css)
Install Docker on Pop!_OS 22.04 LTS.
Install Docker on Pop!_OS 22.04 LTS.

This installs the following Docker components:

  • docker-ce: The Docker engine itself.
  • docker-ce-cli: A command line tool that lets you talk to the Docker daemon.
  • containerd.io: A container runtime that manages the containerโ€™s lifecycle.
  • docker-buildx-plugin: A CLI plugin that extends the Docker build with many new features.
  • docker-compose-plugin: A configuration management plugin to orchestrate creating and managing Docker containers through compose files.

That’s all! Docker should now be installed; the service should start in the background and be automatically enabled to run on boot. Let’s check its status.

sudo systemctl is-active docker
Check the status of the Docker service.
Check the status of the Docker service.

Step 6: Verify the Docker Installation

Now letโ€™s check if everything with our new Docker installation works properly. For this purpose, we will run a simple application called โ€œhello-world.โ€

sudo docker run hello-world
Docker successfully installed, up & running on Pop!_OS 22.04.
Docker successfully installed, up & running on Pop!_OS 22.04.

Congratulations! As we can see, everything works as expected!

Enabling Non-root Users to Run Docker Commands

So far, we have successfully installed Docker on our Pop!_OS 22.04 system. However, only root and users with sudo privileges can execute Docker commands by default.

In other words, if you attempt to run the docker command without prefixing it with sudo, youโ€™ll get an error message like this:

Docker permission denied.
Docker permission denied.

But don’t panic! To run Docker commands as a non-root user, you must first add your user to the “docker” group. It is a simple task. To do that, type in the following:

sudo usermod -aG docker ${USER}

In the above command, “${USER}” is a system environment variable that contains your username. To apply for the new group membership, reboot your Pop!_OS system.

You can then execute docker commands without prefixing them with sudo.

Run the docker command as a regular user.
Run the docker command as a regular user.

Conclusion

Docker is a powerful tool that can significantly enhance your ability to manage and deploy applications in a lightweight and efficient manner. By following the steps outlined in this article, you should have a working Docker installation on your Pop!_OS 22.04 system.

So, what are you waiting for? Start experimenting with it and see how it can revolutionize how you build and deploy applications.

To learn more about Docker, check out the official Docker documentation. Additionally, we recommend our detailed guide to expanding your skills with Docker and learning how to run and manage multi-container applications using Docker Compose. Happy dockering!

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Think You're an Ubuntu Expert? Let's Find Out!

Put your knowledge to the test in our lightning-fast Ubuntu quiz!
Ten questions to challenge yourself to see if you're a Linux legend or just a penguin in the making.

1 / 10

Ubuntu is an ancient African word that means:

2 / 10

Who is the Ubuntu's founder?

3 / 10

What year was the first official Ubuntu release?

4 / 10

What does the Ubuntu logo symbolize?

5 / 10

What package format does Ubuntu use for installing software?

6 / 10

When are Ubuntu's LTS versions released?

7 / 10

What is Unity?

8 / 10

What are Ubuntu versions named after?

9 / 10

What's Ubuntu Core?

10 / 10

Which Ubuntu version is Snap introduced?

The average score is 68%