How To Install Docker on Rocky Linux 8
In this tutorial, we will show you how to install Docker on Rocky Linux 8. For those of you who didn’t know, Docker is basically a container engine that uses the Linux Kernel in order to create the containers on top of an operating system. Docker provides the ability to easily run your applications on any machine regardless of operating system or platform. The CE version of Docker is a rebrand of the Docker open-source solution. There is an Enterprise Edition if you need support from Docker Inc on your container platform.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the Docker CE on Rocky Linux. 8.
Prerequisites
- A server running one of the following operating systems: Rocky Linux 8.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Docker on Rocky Linux 8
Step 1. The first step is to update your system to the latest version of the package list. To do so, run the following commands:
sudo dnf check-update sudo dnf update sudo dnf install dnf-utils
Step 2. Installing Docker on Rocky Linux 8.
By default, Docker is not available on Rocky Linux 8 base repository. Now run the following command below to add the Docker CE repository to your system:
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Once complete added repository, now install the Docker CE package on Rocky Linux 8 by using the following command:
sudo dnf update
sudo dnf install docker-ce --nobest
After successfully installation, enable Docker CE (to start automatically upon system boot), start and verify the status using the commands below:
sudo systemctl enable docker sudo systemctl start docker sudo systemctl status docker
Verify the version of Docker Enterprise Edition:
docker --version
Step 3. Add Rocky Linux User to Docker User Group.
If you don’t want to use “sudo
” to run a Docker command on your system, you need to add the no-root user of your system to the Docker group:
sudo usermod -aG docker $USER reboot
Step 4. Test Docker Installation.
To test Docker, pull the hello world packages on your system by running the following command:
docker pull hello-world
Output:
Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/
This output verifies that Docker is working properly on your system.
Congratulations! You have successfully installed Docker. Thanks for using this tutorial for installing the Docker container on your Rocky Linux 8 system. For additional help or useful information, we recommend you check the official Docker website.