Docker is a platform for developers and system administrators to develop, ship, and run applications in containers. Containers are lightweight, portable, and self-sufficient environments that allow applications to run consistently across different environments. It allows developers to package their applications and dependencies into a container, which can then be easily deployed and run on any host with Docker installed. This helps to ensure that the application will run the same way in the development, testing, and production environments.
To install Docker on Rocky Linux, we need to add this repository to our system. Docker does not officially support Rocky Linux as a separate independent distribution. Instead, we have to use the CentOS repository, which works flawlessly.
Step 1. Adding the repository
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Code language: JavaScript (javascript)
Step 2. In this step, we install Docker and its dependencies.
sudo dnf -y install docker-ce docker-ce-cli containerd.io
Code language: CSS (css)
After the step above completes, we can make Docker run rootless. This way, we don’t need to run sudo before running Docker.
If you are setting up Docker for the Minikube environment, skip the step below.
Step 3. Make Docker run rootless.
dockerd-rootless-setuptool.sh install --skip-iptables
Code language: CSS (css)
Let’s test if Docker works.
docker run hello-world
If the docker run hello-world ran successfully, you have a working Docker install.
That’s it, folks. Now you can ship containers.