install Docker CE on Rocky Linux 8

The steps given here will also work for RHEL and CentOS 8

  1. Add Docker Repo on Rocky Linux
    Add an official Docker CE repository on your Rocky Linux 8, so that we can install it without downloading its packages manually.

sudo dnf config-manager --add-repo=

  1. Run system update
    To let the system recognize the added Docker repository and the packages available in the same, run the system update that will force Rocky Linux to rebuild the system repo cache.

sudo dnf update

  1. Command to Install Docker CE Engine
    So, we already have the Docker repo and now it’s time to run the simple command using the DNF package manager for installing the Docker-CE along with its command-line tool and to efficiently manage the container lifecycle of its host system.

sudo dnf install docker-ce docker-ce-cli

  1. Enable and Start Docker Service
    Once the installation is completed, start the Docker service on your Rocky Linux and enable it to run automatically with system boot.

sudo systemctl enable docker

sudo systemctl start docker
Check the Status of the Service to know if it is working properly.

systemctl status docker

  1. Add Rocky Linux User to Docker User Group
    To run docker commands we need sudo rights or root access and to avoid that add your current system user to the Docker group so that you can easily run its command for downloading and creating containers.

sudo usermod -aG docker $USER
Check whether your user is in the docker group or not.

id $USER
If you want to use some other user than the current one, simply replace $USER in the above command with the specific system’s user you want to give the rights to manage Docker.

Restart the Server

To make sure all the changes work smoothly restart your host Rocky Linux server or desktop where you have installed the Docker.

To get the information and details related to installer docker such as version, several containers installed, Host kernel version, Architecture, CPU, OS Name, etc. Type:

docker info

  1. Test Docker by pulling Image
    Let’s download some Images such as Ubuntu to create a Container and test, whether everything is working fine or not.

docker pull ubuntu
The above command will fetch the latest Image file of the LTS version i.e. Ubuntu 20.04 LTS to install and create a container corresponding to it from Docker Hub.

To know what are Images have been downloaded and available to use on your Docker system locally, run:

docker images

  1. Run Container
    Now, we have the Docker Image of Ubuntu, let’s create and run a container using it. The command for that is very simple:

docker run -it ubuntu
After that, you can use the Ubuntu APT package manager to run the command and install the various applications over it. Know more about its commands and work on the official documentation page.