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
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
Recent Comments