How to Install Docker on Rocky Linux 10: A Step-by-Step Guide

A step-by-step guide to installing Docker on Rocky Linux 10, offering a solid Enterprise Linux foundation for containerized workloads.

Docker has become a go-to tool for managing containerized applications, offering portability, scalability, and efficiency across diverse environments. Rocky Linux 10, with its solid Enterprise Linux foundation, provides an ideal platform for running containerized workloads reliably in production settings.

In this guide, I’ll walk you through the process of installing Docker on Rocky Linux 10. By following these steps, you’ll be up and running with Docker in no time, ready to build and manage containers with confidence on a robust RHEL-compatible platform.

Install Docker on Rocky Linux 10

Step 1: Refresh the Package Base

First, refresh the packages on your Rocky system to ensure you’re using the latest software versions available in the distro’s repos. If there are pending updates, apply them.

sudo dnf updateCode language: Bash (bash)
Refreshing the package base.
Refreshing the package base.

If you’re unsure about using Rocky’s DNF package manager, I highly recommend checking out our “DNF Command-Line Package Manager in Linux: A Complete Guide.” Now, back to the topic.

Step 2: Add Docker Repository

Now let’s add the official Docker repository to your Rocky Linux 10 system so you can install and update Docker directly from upstream’s maintained RPM packages.

sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repoCode language: Bash (bash)
Adding the official Docker repository.
Adding the official Docker repository.

Step 3: Run System Update

Run the system update, which will force your Rocky system to refresh the package metadata for all enabled repositories and the packages available in them.

sudo dnf updateCode language: Bash (bash)
Refreshing the package base.
Refreshing the package base.

As you can see from the command’s output, the newly added Docker repo is now available under the “Docker CE Stable – x86_64” name. Additionally, you can also use the command below to verify that the Docker repo was properly added:

sudo dnf repolistCode language: Bash (bash)
List of available repositories in Rocky Linux.
List of available repositories in Rocky Linux.

Step 4: Install Docker on Rocky Linux 10

Finally, run the following command to install the latest up-to-date Docker release on Rocky Linux 10.

sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginCode language: Bash (bash)
Install Docker on Rocky Linux 10.
Install Docker on Rocky Linux 10.

This installs the following Docker components:

  • docker-ce: The Docker engine itself.
  • docker-ce-cli: A command-line tool that lets you talk to the Docker daemon.
  • containerd.io: A container runtime that manages the container’s lifecycle.
  • docker-buildx-plugin: This extension for Docker enhances the capabilities of building images, mainly focusing on multi-platform builds.
  • docker-compose-plugin: A configuration management plugin that helps manage multi-container Docker applications using a single YAML file.

Confirm with “Y.” Next, you will be asked to accept the Docker repo’s GPG key to be imported into your Rocky system. Confirm again with “Y.”

Importing the repo’s GPG key.
Importing the repo’s GPG key.

Wait for the installation to finish—it should take no more than 30 seconds.

Install Docker on Rocky Linux 10.
Install Docker on Rocky Linux 10.

Step 5: Enable and Start the Docker Service

Now, you can launch the Docker service and configure it to start automatically when the system boots:

sudo systemctl enable --now dockerCode language: Bash (bash)
Start Docker and enable its systemd service so it starts automatically at boot.
Start Docker and enable its systemd service so it starts automatically at boot.

To confirm that the Docker service has been enabled and started, run:

sudo systemctl status dockerCode language: Bash (bash)
The Docker service is enabled and running.
The Docker service is enabled and running.

Alternatively, you can use the command below:

sudo systemctl is-active dockerCode language: Bash (bash)
Confirmation that Docker has started.
Confirmation that Docker has started.

Step 6: Verify Installation

We come to the most exciting part. Let’s test if our new Docker installation works correctly by running a simple containerized application called “hello-world.”

sudo docker run hello-world
Docker successfully installed, up & running on Rocky Linux 10.
Docker successfully installed, up & running on Rocky Linux 10.

Congratulations! As we can see, everything works properly.

Enabling Non-root Users to Run Docker Commands

We have successfully installed Docker on Rocky Linux 10 so far. However, only root and users with sudo privileges can execute docker commands by default.

In other words, if you attempt to run the docker command without prefixing it with sudo, you’ll get an error message like this:

Docker permission denied.
Docker permission denied.

But there is no room for worries. To run docker commands as a non-root user, you must first add your user to the “docker” group. It is a simple task. To do that, type in the following:

sudo usermod -aG docker ${USER}Code language: Bash (bash)

In the above command, “${USER}” is a system environment variable that contains your username. Then, run the following command to activate the changes to the group:

newgrp dockerCode language: Bash (bash)

You can then execute docker commands without prefixing them with sudo.

Run the docker command as a regular user.
Run the docker command as a regular user.

Remember that this temporary solution will work only for your current terminal session. In other words, if you close the terminal, you will either have to execute the newgrp command above again or prefix docker commands with sudo. To make this change system-wide and to last permanently, restart your Rocky system.

Conclusion

Installing Docker on Rocky Linux 10 provides a robust and reliable Enterprise Linux foundation perfectly suited for managing containerized workloads.

To learn more about Docker, check out its official documentation. Additionally, I recommend our detailed guide to expanding your skills with Docker and learning how to run and manage multi-container applications using Docker Compose.

If you encounter any issues or have questions, let me know in the comments section below. Thank you for following this tutorial, and happy Dockerizing!

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Leave a Reply

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