In this article, we will have explained the necessary steps to install Docker on Rocky Linux 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo
privileges. All the commands in this tutorial should be run as a non-root user.
Docker is an open-source project that allows you to easily and quickly build, test, and deploy applications. Docker also allows you to quickly deploy and scale applications in any environment. Developers can use the development environments on Windows, Linux, or macOS. Today, many developers use Docker for testing and deploying their apps within containers. Containers are resource-isolated virtual instances that provide the ability to run several isolated systems on a single host machine.
Install Docker on Rocky Linux 8
Step 1. First, before you start installing any package on your Rocky Linux server, we always recommend making sure that all system packages are updated.
sudo dnf update sudo dnf upgrade sudo dnf install dnf-utils
Step 2. Install Docker on the Rocky Linux system.
Add the official Docker repository by using the following command:
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Next, install Docker-CE package on Rocky Linux by running the following command:
sudo dnf update sudo dnf install docker-ce --nobest
Once the docker installation gets completed, start the services for the docker and enable it after rebooting the System:
sudo systemctl start docker sudo systemctl enable docker sudo systemctl status docker
You can verify the Docker version with the following command:
docker --version
Step 3. Add Local User to the Docker Group.
Now add your current system user into the Docker group so that you can easily run the docker commands without using sudo
:
sudo usermod -aG docker $USER
Step 4. Testing Docker in Rocky Linux.
To test docker installation, run the below command:
docker run hello-world
Output:
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world b8dfde127a29: Pull complete Digest: sha256:61bd3cb6godetz4ff4c6407a5a7fr3akzfa8eefdbbec539eokco7f63e09f Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly.
We will pull a Ubuntu image, run and interact with the container:
docker pull ubuntu
Once the image is pulled, confirm the existing images:
docker images
After that, run Ubuntu Docker container:
docker run -it ubuntu
That’s all you need to do to install Docker on Rocky Linux 8. I hope you find this quick tip helpful. For further reading on the Docker container engine, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.