How To Install Docker on Ubuntu 22.04

Spread the love


Docker, a leading containerization platform, allows developers to build, ship, and run applications consistently across multiple environments. This guide will walk you through the installation and configuration of Docker on the Ubuntu 22.04 LTS release. Know more about Docker Commands : Essential Docker Commands Every Developer Should Know


Before we begin, make sure you have access to a Ubuntu Linux terminal with administrative privileges on your Ubuntu 22.04 system.

Step 1: Update Package Database

To start, update the package database to ensure you have the latest information about available packages. 

sudo apt update 

Step 2: Install Dependencies 

Install necessary dependencies to allow Docker to use repositories over HTTPS. 

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

Step 3: Add Docker’s GPG Key 

Add Docker’s GPG key to ensure the integrity of the downloaded packages. 

curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg 

Step 4: Set Up Stable Docker Repository

Configure the stable Docker repository for Ubuntu 22.04. 

echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 

Step 5: Install Docker Engine 

Update the package database and install the Docker Engine.

sudo apt update 
sudo apt install docker-ce docker-ce-cli 

Step 6: Manage Docker as a Non-Root User (Optional) 

sudo usermod -aG docker $USER 

Remember to log out and log back in or restart your system for the changes to take effect. 

Step 7: Verify Docker Installation

Ensure Docker is installed correctly by checking the version. 

docker --version 

Step 8: Run a Docker Container (Optional) 

See also  How to install docker in Ubuntu 16.04

Test your Docker installation by running a simple container. 

docker run hello-world 

This should output a message confirming that your Docker installation is operational. 

Additional Configuration (Optional)

Configure Docker to Start on Boot:

sudo systemctl enable docker 

Configure Docker to Use a Proxy (if applicable):

 Create or edit the Docker service configuration file. 

sudo nano /etc/systemd/system/docker.service.d/http-proxy.conf

Add proxy information. 


Save the file and restart the Docker service. 

sudo systemctl daemon-reload 
sudo systemctl restart docker 


Congratulations! Docker has been installed and configured successfully on Ubuntu 22.04. Docker is a powerful containerization platform that allows you to streamline your development and deployment processes. Stay tuned for more tech tutorials and guides on our blog Linux Guru to help you improve your skills and stay current with the latest technologies. 

You may like this post : Essential Docker Commands Every Developer Should Know

Leave a Comment