sammlinux sammlinux
  • Ubuntu
    UbuntuShow More
    How To Install and Use Docker CE on Ubuntu 22.04
    26 Min Read
    How To Install and Secure phpMyAdmin on Ubuntu 22.04
    5 Min Read
    How To Secure SSH with Fail2Ban on Ubuntu 22.04
    8 Min Read
    How To Install Uptime Kuma on Ubuntu 22.04
    17 Min Read
    How To Install Ubuntu Server 22.04 LTS with Screenshots
    14 Min Read
  • Rocky Linux
    Rocky LinuxShow More
    How To Install phpMyAdmin on Rocky Linux 9
    15 Min Read
    How To Secure SSH with Fail2Ban on Rocky Linux 9
    12 Min Read
    How To Install Rocky Linux 9.2 Server with Screenshots
    12 Min Read
    How To Set Up a Firewall Using FirewallD on Rocky Linux 9
    8 Min Read
    How To Install Nginx on Rocky Linux 9: A Comprehensive Guide
    10 Min Read
  • Debian
    DebianShow More
    How To Secure SSH with Fail2Ban on Debian 11
    8 Min Read
    How To Install Debian 11 (Bullseye) Server with Pictures
    12 Min Read
    How To Install and Setup Node.js on Debian 11
    6 Min Read
    How To Install PHP 8.2 on Debian 11
    12 Min Read
    How To Install Nginx on Debian 11: A Comprehensive Guide
    9 Min Read
  • Linux
    LinuxShow More
    Best Practices Linux Server Security for System Administrator
    8 Min Read
    A Simple Guide: How To Manage Groups on Linux
    5 Min Read
    How To Manage Log Files Using Logrotate In Linux
    7 Min Read
    The Easy Ways to Check File Size in Linux
    7 Min Read
    How To Backup Files From Remote Linux VPS Using Rsync Script
    12 Min Read
  • CentOS
    CentOSShow More
    How To Secure SSH with Fail2Ban on CentOS 7
    9 Min Read
    How To Install PHP 8.2 on CentOS 7 / RHEL 7
    18 Min Read
    How To Install Apache Web Server on CentOS 7
    11 Min Read
    How To Set Up a Firewall Using FirewallD on CentOS 7
    5 Min Read
    Initial Setup CentOS 7 Server: Secure and Efficient
    9 Min Read
  • DevOps
    DevOpsShow More
    How To Create AWS CloudFront: A Step-by-Step Guide
    10 Min Read
Reading: How To Install Docker CE on Rocky Linux 9
Share
Font ResizerAa
Linux for BeginnersLinux for Beginners
  • Ubuntu
  • Rocky Linux
  • Debian
  • Linux
  • CentOS
  • DevOps
Search
  • Ubuntu
  • Rocky Linux
  • Debian
  • Linux
  • CentOS
  • DevOps
Follow US
Copyright © 2014-2023 Ruby Theme Ltd. All Rights Reserved.

How To Install Docker CE on Rocky Linux 9

Samuel Siahaan
By Samuel Siahaan
Last updated: July 27, 2023
SHARE

Introduction

In the ever-evolving landscape of modern software development and deployment, Docker has become an indispensable tool. Docker provides a streamlined way to package, distribute, and manage applications within isolated containers. In this step-by-step guide, we will walk you through the process of how to install Docker Community Edition (CE) on Rocky Linux 9. By the end of this article, you’ll have a solid foundation to utilize Docker for optimizing your development and deployment workflows.

Contents
IntroductionTable of ContentsPrerequisitesEnvironment Specification:Install Docker CE on Rocky Linux 9Step 1: System UpdateStep 2: Adding Docker repositoryStep 3: Installation of Docker-CE on Rocky Linux 9Step 4: Check Docker VersionStep 5: Run Docker without sudoStep 6: Testing Docker with a Test ImageStep 7: Test Run DockerUninstall Docker CE (optional)Conclusion

Rocky Linux 9 operates on the foundation of an RHEL package-based distribution, while Docker serves as a commercial platform utilized by both individuals and businesses to establish and manage containers. As an open-source software, Docker offers a lightweight alternative to other Type-2 virtualization software, such as VirtualBox. Beyond the availability of pre-built images, it’s also possible to craft our own images for execution within containers powered by the Docker Engine.

For the execution of virtual containers, a system capable of supporting virtualization is required. Fortunately, most modern systems come with this capability enabled by default. However, if not, the manual configuration needs to be done through the BIOS settings.

Table of Contents

  • Introduction
  • Prerequisites
  • Environment Specification:
  • Install Docker CE on Rocky Linux 9
    • Step 1: System Update
    • Step 2: Adding Docker repository
    • Step 3: Installation of Docker-CE on Rocky Linux 9
    • Step 4: Check Docker Version
    • Step 5: Run Docker without sudo
    • Step 6: Testing Docker with a Test Image
    • Step 7: Test Run Docker
  • Uninstall Docker CE (optional)
  • Conclusion

Prerequisites

Before we dive into the installation process, make sure you have the following prerequisites in place: 

- Advertisement -
  • A Rocky Linux 9 system with root or sudo access, you can deploy this on a physical machine or a virtual environment like VMware or VirtualBox. To set this up, follow our guide :
    • Initial Setup Rocky Linux 9 Server: Secure and Efficient 
  • A stable internet connection to download packages
  • Basic familiarity with command-line operations.

Environment Specification:

We are using a minimal Rocky Linux 9 virtual machine with following specifications.

  • CPU – 2 cores
  • Memory – 2 GB
  • Storage – 32 GB
  • Operating System – Rocky Linux release 9.2 (Blue Onyx)
  • Hostname – docker
  • IP Address – 172.32.1.222/24

Install Docker CE on Rocky Linux 9

Follow these steps to install Docker CE on your Rocky Linux 9 and harness its powerful features for your containers:

Step 1: System Update

Refresh your cache for enabled yum repositories.

[samm@docker ~]$ sudo dnf makecache --refresh
Rocky Linux 9 - BaseOS                                                                                                                                                             2.3 kB/s | 4.1 kB     00:01    
Rocky Linux 9 - AppStream                                                                                                                                                          3.0 kB/s | 4.5 kB     00:01    
Rocky Linux 9 - CRB                                                                                                                                                                3.5 kB/s | 4.5 kB     00:01    
Rocky Linux 9 - Extras                                                                                                                                                             1.0 kB/s | 2.9 kB     00:02    
Metadata cache created.
[samm@docker ~]$ sudo dnf update -y

Step 2: Adding Docker repository

Community’s most favorite containerization software is available via Docker’s Official Yum Repository.

Enable the Docker CE repository by running the following command.

- Advertisement -
[samm@docker ~]$ sudo dnf 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

You have added a new yum repository, therefore, rebuild your yum cache again.

[samm@docker ~]$ sudo dnf makecache
Docker CE Stable - x86_64
Rocky Linux 9 - BaseOS                                                                                                                                                             1.8 kB/s | 4.1 kB     00:02    
Rocky Linux 9 - AppStream                                                                                                                                                          2.2 kB/s | 4.5 kB     00:02    
Rocky Linux 9 - CRB                                                                                                                                                                3.1 kB/s | 4.5 kB     00:01    
Rocky Linux 9 - Extras                                                                                                                                                             3.3 kB/s | 2.9 kB     00:00    
Metadata cache created.

Step 3: Installation of Docker-CE on Rocky Linux 9

With our Rocky Linux 9 system all set to receive the latest Docker packages, let’s proceed by using the terminal and the ‘dnf’ package manager to install them. The following command will get you started:

- Advertisement -
[samm@docker ~]$ sudo dnf install docker-ce docker-ce-cli containerd.io
Last metadata expiration check: 0:23:14 ago on Thu 27 Jul 2023 02:49:39 PM EDT.
Dependencies resolved.
===================================================================================================================================================================================================================
 Package                                                     Architecture                             Version                                             Repository                                          Size
===================================================================================================================================================================================================================
Installing:
 containerd.io                                               x86_64                                   1.6.21-3.1.el9                                      docker-ce-stable                                    33 M
 docker-ce                                                   x86_64                                   3:24.0.5-1.el9                                      docker-ce-stable                                    24 M
 docker-ce-cli                                               x86_64                                   1:24.0.5-1.el9                                      docker-ce-stable                                   7.1 M
Installing dependencies:
 container-selinux                                           noarch                                   3:2.205.0-1.el9_2                                   appstream                                           50 k
 docker-ce-rootless-extras                                   x86_64                                   24.0.5-1.el9                                        docker-ce-stable                                   3.9 M
 fuse-overlayfs                                              x86_64                                   1.11-1.el9_2                                        appstream                                           71 k
 fuse3                                                       x86_64                                   3.10.2-5.el9.0.1                                    appstream                                           53 k
 fuse3-libs                                                  x86_64                                   3.10.2-5.el9.0.1                                    appstream                                           91 k
 libslirp                                                    x86_64                                   4.4.0-7.el9                                         appstream                                           68 k
 slirp4netns                                                 x86_64                                   1.2.0-3.el9                                         appstream                                           45 k
Installing weak dependencies:
 docker-buildx-plugin                                        x86_64                                   0.11.2-1.el9                                        docker-ce-stable                                    13 M
 docker-compose-plugin                                       x86_64                                   2.20.2-1.el9                                        docker-ce-stable                                    13 M

Transaction Summary
===================================================================================================================================================================================================================
Install  12 Packages

Total download size: 93 M
Installed size: 373 M

Enable and Start the Docker service.

[samm@docker-ce ~]$ sudo systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

[samm@docker ~]$ sudo systemctl start docker.service

[samm@docker ~]$ sudo systemctl status docker.service
● docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: disabled)
     Active: active (running) since Thu 2023-07-27 15:16:49 EDT; 30min ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 195439 (dockerd)
      Tasks: 11
     Memory: 36.7M
        CPU: 431ms
     CGroup: /system.slice/docker.service
             └─195439 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Jul 27 15:16:47 docker systemd[1]: Starting Docker Application Container Engine...
Jul 27 15:16:47 docker dockerd[195439]: time="2023-07-27T15:16:47.668338031-04:00" level=info msg="Starting up"
Jul 27 15:16:47 docker dockerd[195439]: time="2023-07-27T15:16:47.753811667-04:00" level=info msg="Loading containers: start."
Jul 27 15:16:49 docker dockerd[195439]: time="2023-07-27T15:16:49.033590056-04:00" level=info msg="Firewalld: interface docker0 already part of docker zone, returning"
Jul 27 15:16:49 docker dockerd[195439]: time="2023-07-27T15:16:49.177426451-04:00" level=info msg="Loading containers: done."
Jul 27 15:16:49 docker dockerd[195439]: time="2023-07-27T15:16:49.218304381-04:00" level=info msg="Docker daemon" commit=a61e2b4 graphdriver=overlay2 version=24.0.5
Jul 27 15:16:49 docker dockerd[195439]: time="2023-07-27T15:16:49.218491017-04:00" level=info msg="Daemon has completed initialization"
Jul 27 15:16:49 docker dockerd[195439]: time="2023-07-27T15:16:49.361917835-04:00" level=info msg="API listen on /run/docker.sock"
Jul 27 15:16:49 docker systemd[1]: Started Docker Application Container Engine.
[samm@docker ~]$ sudo systemctl is-enabled docker
enabled

[samm@docker ~]$ sudo systemctl is-active docker
active

Step 4: Check Docker Version

Verify that the Docker command is working fine by querying the version of you Containerization software.

[samm@docker ~]$ sudo docker version

Client: Docker Engine - Community
 Version:           24.0.5
 API version:       1.43
 Go version:        go1.20.6
 Git commit:        ced0996
 Built:             Fri Jul 21 20:36:54 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.5
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.6
  Git commit:       a61e2b4
  Built:            Fri Jul 21 20:35:17 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
 runc:
  Version:          1.1.7
  GitCommit:        v1.1.7-0-g860f061
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
[samm@docker ~]$ docker info

Client: Docker Engine - Community
 Version:    24.0.5
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.20.2
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 1
 Server Version: 24.0.5
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
 runc version: v1.1.7-0-g860f061
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.14.0-284.11.1.el9_2.x86_64
 Operating System: Rocky Linux 9.2 (Blue Onyx)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 3.576GiB
 Name: docker
 ID: 498002d4-7673-4f62-b572-0b91c72d2954
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Step 5: Run Docker without sudo

The next task of ours in installing Docker on Rocky Linux 9 is to run it without sudo. By default, a user has to use sudo with every command of Docker to run it. Hence, we add our current user to its group to solve this.

[sudo usermod -aG docker $username]

[samm@docker ~]$ sudo usermod -aG docker samm
[samm@docker ~]$ sudo chmod 666 /var/run/docker.sock

Reload Shell session

[samm@docker ~]$ newgrp docker

Step 6: Testing Docker with a Test Image

The Linux environment is now prepared to generate containers featuring a range of Linux and application images. However, before proceeding, let’s verify its functionality to ensure that our configuration is accurate and error-free.

[samm@docker ~]$ docker run hello-world

The output will give a confirmation message – Hello from Docker

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
719385e32844: Pull complete 
Digest: sha256:926fac19d22aa2d60f1a276b66a20eb765fbeea2db5dbdaafeb456ad8ce81598
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

Examples of Docker Command Usage

[samm@docker ~]$ docker search alpine --filter is-official=true
NAME      DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
alpine    A minimal Docker image based on Alpine Linux…   10142     [OK] 

Pull Alpine Linux image from Docker Hub.

[samm@docker ~]$ docker pull alpine

Using default tag: latest
latest: Pulling from library/alpine
31e352740f53: Pull complete 
Digest: sha256:82d1e9d7ed48a7523bdebc18cf6290bdb97b82302a8a9c27d4fe885949ea94d1
Status: Downloaded newer image for alpine:latest
docker.io/library/alpine:latest

List down the locally available container images on your Docker Host.

[samm@docker ~]$ docker images
REPOSITORY    TAG       IMAGE ID       CREATED        SIZE
alpine        latest    c1aabb73d233   6 weeks ago    7.33MB
hello-world   latest    9c7a54a9a43c   2 months ago   13.3kB

Step 7: Test Run Docker

Construct a container using the Alpine Linux image, then access a shell within it to perform various test commands.

[samm@docker ~]$ docker run -it --rm alpine /bin/sh
/ # cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.18.2
PRETTY_NAME="Alpine Linux v3.18"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
/ # uname -r
5.14.0-284.11.1.el9_2.x86_64
/ # exit

Uninstall Docker CE (optional)

Only use these commands when you no longer need Docker on Rocky Linux 9. They will remove Docker, including all currently running containers managed by the service.

[samm@docker ~]$ sudo dnf remove -y docker-ce docker-ce-cli containerd.io

[samm@docker ~]$ sudo rm -rf /var/lib/docker

[samm@docker ~]$ sudo rm -rf /var/lib/containerd

Conclusion

Congratulations! You’ve successfully installed Docker CE on Rocky Linux 9. Docker opens up a world of possibilities for packaging, distributing, and managing applications effortlessly. You’re now ready to explore containerization and take advantage of the benefits it offers to modern software development. Whether you’re a developer, system administrator, or IT professional, Docker will undoubtedly enhance your workflow and make your life easier. Happy containerizing!

Also Read Our Other Guides :

  • Install and Configure Docker Swarm Mode on Centos 7
  • How To Install Docker CE on Centos 7
  • How To Install and Use Docker Compose on Centos 7
  • How To Install and Use Docker CE on Ubuntu 22.04

Hopefully, now you have learned how to install Docker CE on Rocky Linux 9.

TAGGED:CentOSContainersDockerRocky LinuxVirtual Machine

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
[mc4wp_form]
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Copy Link Print
Previous Article How To Install a MinIO Object Storage Server on Rocky Linux (Part 2)
Next Article Initial Setup Ubuntu Server 22.04: Secure and Efficient
Leave a Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

How To Install and Secure phpMyAdmin on Ubuntu 22.04
Ubuntu
Install and Configure Docker Swarm Mode on Centos 7
CentOS
How To Install and Config Thumbor on Debian 10
Debian
How To Install MariaDB 10.6 on Debian 11 Server
Debian
How To Install MongoDB 6.0 on Debian 10 & 11
Debian

You Might Also Like

Rocky Linux

How To Secure SSH with Fail2Ban on Rocky Linux 9

12 Min Read
Rocky Linux

How To Install Varnish Cache for Nginx on Rocky Linux 9

14 Min Read
Rocky Linux

How To Install phpMyAdmin on Rocky Linux 9

15 Min Read
Rocky Linux

How To Install Rocky Linux 9.2 Server with Screenshots

12 Min Read
CentOS

How To Secure SSH with Fail2Ban on CentOS 7

9 Min Read
Rocky Linux

How To Secure Nginx with Let’s Encrypt on Rocky Linux 9

20 Min Read
Rocky Linux

How To Install PHP 8.2 on Rocky Linux 9

9 Min Read
Rocky Linux

How To Set Up a Firewall Using FirewallD on Rocky Linux 9

8 Min Read
Show More

Always Stay Up to Date

Subscribe to our newsletter to get our newest articles instantly!

sammlinux sammlinux

Providing beginner-friendly Linux tutorials and open-source guides to simplify your digital infrastructure.

www.sammlinux.com © 2026 | All Rights Reserved

Join Us!
Subscribe to our newsletter and never miss our latest news, podcasts etc.

Subscribe to our newsletter to get our newest articles instantly!

Zero spam, Unsubscribe at any time.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?