Hello, friends. In this post, you will learn how to install Docker CE on Rocky Linux 8. The process is simple, and we will be able to install the latest stable version of the tool.
Docker is a technology that allows us to deploy applications and operating systems in containers that are distributed in images.
Many blogs have commented on Docker, including ours. That is why this technology is so popular and so widely used worldwide.
As we know, CentOS 8 came to an end on December 31 of last year, so we have to migrate to alternatives such as Rocky Linux or Alma Linux.
So let’s go for it.
Installing Docker CE on Rocky Linux 8
Docker has a dedicated CentOS repository that we can apply to Rocky Linux. So, the ideal would be to add it to the system and install it from there.
First access your server via SSH or, if you are using Rocky Linux from the desktop, open a terminal.
Now install the yum-utils
package.
sudo dnf install yum-utils
With this package installed, we can add the Docker repository.
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Output:
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
If you want to check if the repository has been successfully added, you can run
sudo dnf repolist
Thereafter, you can install Docker CE and its packages on the system.
sudo dnf install docker-ce docker-ce-cli containerd.io
With this process, Docker is already installed, but its service is not started.
To start the Docker service, run
sudo systemctl start docker
It is convenient that the service starts with the system, to do this
sudo systemctl enable docker
Output:
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/system/docker.service
Finally, you can check the status of the service
sudo systemctl status docker
In conclusion, Docker is installed correctly.
First steps with Docker CE on Rocky Linux
Using Docker requires root permissions. This can be a problem for many people, so a real option would be to add the user to the docker
group.
To complete this, run the following command
sudo usermod -aG docker $USER
Now, you can run Docker and for this you can use the test image.
docker run hello-world
In case you get permissions error, just restart the terminal or the SSH session.
So, you will get an output screen similar to this one.
Indicating that Docker has been successfully installed on the system.
Conclusion
In this post, you have learned how to install Docker CE on Rocky Linux 8, I hope it has helped you. Don’t forget to share the post.