RHEL BasedRocky Linux

How To Install Docker on Rocky Linux 9

Install Docker on Rocky Linux 9

In this tutorial, we will show you how to install Docker on Rocky Linux 9. For those of you who didn’t know, Docker CE is a free and open-source containerization platform. Docker uses the Linux Kernel to create containers on top of an operating system. Which is used to create, deploy and run the applications.

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 Docker containers on Rocky Linux. 9.

Prerequisites

  • A server running one of the following operating systems: Rocky Linux 9.
  • 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).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Docker.
  • A non-root sudo user or access to the root user. We recommend acting as a non-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 9

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 install dnf-utils
sudo dnf install device-mapper-persistent-data lvm2

Step 2. Installing Docker on Rocky Linux 9.

By default, Docker is not available on Rocky Linux 9 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

After the repositories have been added to the system, now run the following command to install Docker CE Rocky Linux:

sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin --allowerasing

Once the installation is completed, start the Docker service on your Rocky Linux and also enable it to run automatically with system boot:

sudo systemctl enable docker
sudo systemctl start docker

Step 3. Add User to Docker Group.

Add user to Docker group using the command:

sudo usermod -aG docker $USER

Next, create a new group:

newgrp docker

Verify the Docker version is installed:

docker version

Output:

Client: Docker Engine - Community
 Version:           20.10.18
 API version:       1.42
 Go version:        go1.17.13
 Git commit:        100c701
 Built:             Mon Aug 5 19:04:29 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.18
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Aug 5 19:04:29 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.7
  GitCommit:        10c12954828e7c7c9b6g0det2b01407d3ae1
 runc:
  Version:          1.1.3
  GitCommit:        v1.1.2-0-ga916309
 docker-init:
  Version:          0.20.0
  GitCommit:        de40ad0

Step 4. Test Docker by pulling the Image.

Now we download some Images such as Ubuntu to create a Container and test, whether everything is working fine or not:

docker pull ubuntu

Once done, let’s create and run a container using it. The command for that is very simple:

docker run -it ubuntu

Congratulations! You have successfully installed docker. Thanks for using this tutorial for installing Docker CE on your Rocky Linux 9 system. For additional help or useful information, we recommend you check the official Docker website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button