How to Install Docker on Ubuntu 22.04 (Step-by-Step Guide)

Docker is a powerful containerization platform that allows developers to build, ship, and run applications in isolated environments. In this tutorial, we will walk through the step-by-step process of installing Docker on Ubuntu 22.04 LTS.

📋 Prerequisites

Before you begin, make sure:

  • You are running Ubuntu 22.04
  • You have a non-root user with sudo privileges
  • Your system is updated

Step 1: Update System Packages

First, update your package list to ensure you install the latest versions:

sudo apt update
sudo apt upgrade -y

Step 2: Install Required Dependencies

Install packages required to allow apt to use repositories over HTTPS:

sudo apt install apt-transport-https ca-certificates curl software-properties-common lsb-release -y

Step 3: Add Docker’s Official GPG Key

Add Docker’s official GPG key to verify package authenticity:

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

Step 4: Add Docker Repository

Add the official Docker repository to your system:

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

Step 5: Update Package List Again

Now update your package list to include Docker packages:

sudo apt update

Step 6: Install Docker Engine

Install Docker Engine, CLI, and containerd:

sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

Step 7: Verify Docker Installation

Check if Docker is installed correctly:

sudo systemctl status docker

You should see Docker service running.

You can also check the Docker version:

docker --version

Step 8: Run Docker Without sudo (Optional but Recommended)

To avoid typing sudo every time:

sudo usermod -aG docker $USER

Then log out and log back in, or run:

newgrp docker

Test it:

docker run hello-world

If everything is working, you’ll see a confirmation message from Docker.

🚀 Enable Docker to Start on Boot


Docker usually enables itself automatically, but you can ensure it:


sudo systemctl enable docker

🎉 Conclusion

You have successfully installed Docker on Ubuntu 22.04. You can now start creating and running containers on your system.

If you found this tutorial helpful, feel free to share it!

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *