Cantech Knowledge Base

Your Go-To Hosting Resource

How to Install Docker on Rocky Linux 9?

To install Docker on Rocky Linux 9, add the official Docker CE repository with dnf config-manager, install docker-ce, docker-ce-cli, containerd.io and the Buildx and Compose plugins with dnf, then run sudo systemctl enable --now docker. Verify with docker run hello-world.

Introduction

Docker is a popular open-source platform designed to simplify the development, deployment, and running of applications by using container technology. Containers are lightweight, portable, and self-sufficient units that bundle application code with all its dependencies, ensuring it runs reliably across different environments.

In this guide, you will learn how to install Docker on a Rocky Linux 9 server, manage the Docker service, run containerized applications, and push images to a container registry. This tutorial is suitable for developers and system administrators looking to work with containerized environments on Rocky Linux. Learn the complete setup in how to install docker on debian.

Prerequisites

Before you begin:

  • You should have a Rocky Linux 9 server instance ready.
  • Access the server using SSH as a non-root user with sudo privileges.
  • Make sure your system packages are up to date.

To update the system, run:

sudo dnf update -y

Step 1: Install Docker on Rocky Linux 9

Although Docker is available in the default Rocky Linux repositories, the latest version may not be. Follow the steps below to install the latest Docker version.

1. Install dnf-utils:

sudo dnf install -y dnf-utils

2. Add the Docker repository:

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

3. Install Docker and dependencies:

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

Understand the process behind how to install docker on ubuntu.

Step 2: Manage the Docker Service

Docker runs as a systemd service. You need to enable and manage it as follows:

1. Start the Docker service:

sudo systemctl start docker

2. Enable Docker to start on boot:

sudo systemctl enable docker

3. Check Docker service status:

sudo systemctl status docker

The output should show Docker is active and running.

4. (Optional) Stop or restart Docker:

sudo systemctl stop docker
sudo systemctl restart docker

Step 3: Run a Sample Docker Container

To verify that Docker is working properly, you can pull and run a sample container.

1. Pull the Hello World image:

docker pull crccheck/hello-world

2. List available Docker images:

docker images

3. Run a container in detached mode:

docker run -d --name web-test -p 80:8000 crccheck/hello-world

4. Verify running containers:

docker ps

You should see the container web-test running and exposing port 80 on the host.

5. Test your container:

curl http://127.0.0.1:80

You should see:

Hello World

You can also access the app via your server’s IP address in a browser:

http://your-server-ip:80

Step 4: Push Docker Images to a Container Registry (Optional)

To share or deploy your custom Docker images, you can push them to a container registry such as Docker Hub or a private registry.

1. Log in to the registry:

docker login

2. Tag the image:

docker tag crccheck/hello-world:latest yourusername/hello-world:latest

3. Push the image:

docker push yourusername/hello-world:latest

You can now access your image from any machine with Docker installed. Read our details guide blog how to remove docker images.

Step 5: Deploy Container from a Remote Image

Once your image is pushed to a container registry, you can pull and deploy it on any server:

docker run -d --name web-test-remote -p 8080:8000 yourusername/hello-world:latest

Verify it with:

curl http://127.0.0.1:8080

Or visit:

http://your-server-ip:8080

Conclusion

You have successfully installed Docker on Rocky Linux 9 and deployed containerized applications. Docker is a powerful tool for application packaging, isolation, and scaling. You can now build, tag, push, and run Docker containers with ease, enabling you to streamline development and deployment processes across various environments.

For more advanced use cases, consider exploring Docker Compose, Docker Swarm, or Kubernetes for orchestrating multi-container applications and managing workloads at scale.

FAQs

Is there an official Rocky Linux Docker image?

Yes. Rocky Linux publishes base images on Docker Hub as rockylinux and rockylinux/rockylinux, with tags such as 8 and 9. Pull the Rocky Linux 9 image with docker pull rockylinux:9, open a shell in it with docker run -it rockylinux:9 bash, or use it in a Dockerfile with FROM rockylinux:9.

What is the difference between Docker and Podman on Rocky Linux 9?

Rocky Linux 9 ships Podman in its default repositories, while Docker CE needs Docker’s official repo. Podman is daemonless and runs rootless by default, while Docker uses a background daemon (dockerd). Both run OCI images with near-identical commands. Don’t install podman-docker alongside docker-ce, because the two packages conflict.

How do I run Docker without sudo on Rocky Linux?

Add your user to the docker group with sudo usermod -aG docker $USER. Then log out and back in, or run newgrp docker, and confirm with docker ps. Members of the docker group have root-equivalent access to the host, so add only trusted users.

How do I pull and install a Docker image?

Docker images aren’t installed like packages; you pull them from a registry. Run docker pull nginx:latest to download an image, docker images to list it, and docker run -d --name web -p 8080:80 nginx to start a container from it.

How do I uninstall Docker on Rocky Linux?

Run sudo dnf remove -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin. Images, containers and volumes are not removed automatically. To delete them too, run sudo rm -rf /var/lib/docker /var/lib/containerd. This permanently removes all Docker data.

Read a quick overview of how to install Docker CE on Debian 11.

October 2, 2026