How to Install Docker on Ubuntu 26.04 (2 Methods)

Share your love

Docker is a containerization platform that makes it easier to build, deploy, and run applications in a consistent environment. It packages an application together with the libraries, dependencies, and other components it needs into a container. These containers are isolated from each other, allowing multiple applications to run independently on the same computer or server. For example, you can create and test an application on your local machine and then deploy the same container to a testing server or cloud environment without having to recreate the entire application setup from scratch.

In this tutorial, I will show you how to install Docker on Ubuntu 26.04 using two different methods.

Table of Contents
  1. Prerequisites
  2. Method 1 – Install Docker from Ubuntu's Repository
    1. Step 1 – Update the System
    2. Step 2 – Install Docker
  3. Method 2 – Install Docker from the Official Docker Repository
    1. Step 1 – Update the System
    2. Step 2 – Downloading Tools
    3. Step 3 – Creating keyring directory
    4. Step 4 – Download the GPG key
    5. Step 5 – Assign permission
    6. Step 6 – Add Docker repository
    7. Step 7 – Installing docker
  4. Testing Docker
  5. Uninstalling Docker
  6. Conclusion

Prerequisites

  • A PC or server running Ubuntu 26.04
  • A user account with sudo privileges

Method 1 – Install Docker from Ubuntu’s Repository

Ubuntu provides Docker through its own package repositories. This is the simplest way to install Docker because the package can be installed and updated using the standard APT package manager. The Ubuntu repository is a reliable and convenient way to install Docker, especially if you want a simple installation without adding third-party repositories.

Step 1 – Update the System

In the first step, lets first update the system so that we will have latest packages installed

sudo apt update -y

Step 2 – Install Docker

Now lets install Docker on our system

sudo apt install docker.io -y

Method 2 – Install Docker from the Official Docker Repository

Docker also provides its own official APT repository. Installing Docker from this repository gives you access to Docker’s official Docker Engine packages and allows you to receive updates through APT.

Step 1 – Update the System

Let’s first update our system

sudo apt update -y

Step 2 – Downloading Tools

Now lets download the required tools which will add GPG keys over HTTPS

sudo apt install ca-certificates curl -y

Step 3 – Creating keyring directory

In this step, we will create the keyring directory with the required permissions.

sudo install -m 0755 -d /etc/apt/keyrings

Step 4 – Download the GPG key

Now, let’s download Docker’s GPG key and save it in the keyring directory we created above.

sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc

Step 5 – Assign permission

Now, let’s assign the required permissions to the GPG key.

sudo chmod a+r /etc/apt/keyrings/docker.asc

Step 6 – Add Docker repository

Now lets add the Docker repository to the sources list of the system

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] 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 7 – Installing docker

Now lets first update the repository and then install Docker

sudo apt update -y

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

Testing Docker

Now, let’s verify that Docker is installed and working correctly.

sudo docker run hello-world

Uninstalling Docker

If you no longer need Docker, you can remove it from your system using the following commands.

If you installed Docker using Method 1:

sudo apt purge docker.io

If you installed Docker using Method 2:

sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
Note:- Removing Docker packages does not automatically remove Docker images, containers, volumes, or other Docker data stored on the system.

Conclusion

With the steps above, you have successfully installed Docker on Ubuntu 26.04. You can now start using Docker to create and manage containers on your system.

Frequently asked questions

What is the difference between docker.io and docker-ce?

docker.io is the Docker package provided through Ubuntu’s repositories, while docker-ce is Docker’s official Docker Engine package available through Docker’s own repository.

Which method should I use to install Docker on Ubuntu 26.04?

If you want the simplest installation, you can use Ubuntu’s docker.io package. If you prefer Docker’s official packages and repository, use the second method.

Can I run Docker without using sudo?

Yes. You can add your user account to the docker group and then run Docker commands without sudo. However, membership in the docker group provides root-level control over the Docker host, so it should be used carefully.

Sourabh Verma
Sourabh Verma

Hi, I'm Sourabh Verma, an IT professional with 12+ years of experience. At BeginnersBox, I share practical, well-tested how-to guides on Windows, Linux, WordPress, web hosting, and other tech topics. My goal is to provide simple, reliable solutions that actually work.
Hope you like my work. Thanks

Leave a Reply

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

2 × 2 =

Discover more from BeginnersBox

Subscribe now to keep reading and get access to the full archive.

Continue reading