Installation Guides 3d ago 7 views 3 min read

How to Install Docker Engine on Rocky Linux 9

Install Docker Engine on Rocky Linux 9 using the official repository. This guide covers adding the repository, installing the package, and verifying the setup.

Master Sensei
Updated 6h ago
Sponsored

Cloud VPS — scale in minutes

Instantly deploy SSD cloud VPS with guaranteed resources, snapshots and per-hour billing. Pay only for what you use.

You will install Docker Engine on Rocky Linux 9 using the official repository. These steps target Rocky Linux 9.0 and later versions running on x86_64 or aarch64 architecture.

Prerequisites

  • A Rocky Linux 9 system with root access.
  • At least 2 GB of free RAM.
  • Network connectivity to access the Rocky Linux repositories and Docker's official repository.
  • A terminal with a text editor like nano or vim.

Step 1: Install the required packages

Docker requires specific packages to function correctly. Install the necessary dependencies using the dnf package manager. This ensures your system has the required libraries.

dnf install -y yum-utils device-mapper-persistent-data lvm2

You will see output similar to this:

Loading mirror speeds from cache file...
Resolving Dependencies
---> Running transaction
  ...
Complete!

Step 2: Add the Docker repository

Add the official Docker repository to your system. This ensures you get the latest Docker Engine versions. Use the dnf-config-manager command to add the repository configuration.

dnf-config-manager --add-repo https://download.docker.com/linux/rockylinux/docker-ce.repo

The command adds the repository file to /etc/yum.repos.d/docker-ce.repo. Verify the repository was added by listing the available repositories:

dnf repolist

You should see docker-ce in the list of enabled repositories.

Step 3: Install Docker Engine

Install the Docker Engine package using dnf. This command pulls the latest stable version of Docker from the official repository. The -y flag automatically answers "yes" to prompts.

dnf install -y docker-ce docker-ce-cli containerd.io

The installation process downloads the packages and configures them. Wait for the progress bar to complete. You will see output indicating the installation is finished.

Step 4: Start and enable Docker

Start the Docker service immediately and configure it to start on boot. This ensures Docker is ready to run containers as soon as the system boots.

systemctl start docker
systemctl enable docker

Check the status of the Docker service to confirm it is running:

systemctl status docker

The output should show Active: active (running).

Verify the installation

Run the docker command to verify the installation. You should see the Docker version and build information.

docker --version

Expected output:

Docker version 27.1.1, build 09a026d

Run a test container to ensure Docker works correctly. Pull the official hello-world image and run it:

docker run hello-world

You will see a message confirming that the container was created successfully and that Docker is functioning as expected.

Troubleshooting

If you encounter the error Cannot connect to the Docker daemon, check if the service is running:

systemctl status docker

If the service is not running, start it manually:

systemctl start docker

If you see an error about permission denied when running docker commands, add your user to the docker group:

usermod -aG docker $USER
newgrp docker

If the Docker repository is not found, verify your network connectivity and try again:

dnf repolist

Ensure the repository URL in /etc/yum.repos.d/docker-ce.repo is correct. Check for typos in the URL.

Sponsored

Powerful Dedicated Servers — Linux & Windows

Bare-metal performance with SSD storage, DDoS protection and 24/7 expert support. Ideal for production workloads, databases and high-traffic sites.

Tags: LinuxDevOpsDockerContainersRocky Linux
0
Was this helpful?

Related tutorials

Comments 0

Login to leave a comment.

No comments yet — be the first to share your thoughts.