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
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.