1080*80 ad

Installing Docker on Rocky Linux 10

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

Containerization has revolutionized modern software development, and Docker is at the forefront of this transformation. By packaging applications and their dependencies into lightweight, portable containers, Docker ensures consistency across different environments. Rocky Linux 10, known for its stability and performance, provides an excellent foundation for running containerized workloads.

This comprehensive guide will walk you through the official process for installing Docker on a fresh Rocky Linux 10 system. By following these steps, you can set up a robust and secure container environment for your development and deployment needs.

Prerequisites for Installing Docker

Before we begin, ensure you have the following:

  • A system running a clean installation of Rocky Linux 10.
  • Access to a user account with sudo or root privileges.
  • A stable internet connection to download the required packages.

Step 1: Update Your System

First, it’s a critical best practice to ensure your system’s packages are up to date. This prevents potential conflicts and ensures you have the latest security patches. Open your terminal and run the following command:

sudo dnf update -y

This command will download and apply all available updates for your system.

Step 2: Set Up the Official Docker Repository

To ensure you are installing a trusted and current version of Docker, you need to configure your system’s package manager to use the official Docker repository. This is a crucial step that points your system to the correct source for the Docker packages.

Run the following command to add the Docker repository:

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

Your system is now aware of where to find the official Docker Community Edition (CE) packages.

Step 3: Install Docker Engine and Related Packages

With the repository in place, you can now proceed with the installation. This single command will install the Docker Engine, the command-line interface (CLI), containerd, and other essential components.

Execute the command below:

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

This installs the complete Docker toolchain, giving you everything you need to build, run, and manage containers and multi-container applications with Docker Compose.

Step 4: Start and Enable the Docker Service

After the installation is complete, the Docker service will not be running by default. You need to start it manually and then enable it to launch automatically every time the system boots.

To start the Docker service immediately, run:

sudo systemctl start docker

To enable Docker to start on boot, run:

sudo systemctl enable docker

You can verify that the service is active and running without errors by checking its status:

sudo systemctl status docker

You should see an “active (running)” status in green, confirming that the Docker daemon is operational.

Step 5: Verify Your Docker Installation

The best way to confirm that Docker has been installed and configured correctly is to run the classic hello-world container. This simple container downloads a minimal image and prints a confirmation message.

Run the following command:

sudo docker run hello-world

If your installation is successful, you will see output similar to this:

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

This message confirms that Docker was able to pull an image from Docker Hub and run it as a container on your system.

Post-Installation Security Tip: Run Docker Without Sudo

By default, Docker commands require root privileges, which is why we have been using sudo. For security and convenience, it’s recommended to add your user to the docker group. This allows you to run Docker commands without sudo.

Warning: Adding a user to the docker group grants them privileges equivalent to root access. Only add trusted users to this group.

To add your current user to the docker group, use this command:

sudo usermod -aG docker ${USER}

This change will not take effect immediately. For the new group membership to be applied, you must log out of your session and log back in. After logging back in, you can verify your access by running a Docker command without sudo:

docker ps

If the command runs without a “permission denied” error, your configuration is complete.

You have now successfully installed and configured Docker on your Rocky Linux 10 system. You are ready to start building images, deploying applications, and exploring the vast ecosystem of containerization.

Source: https://centlinux.com/install-docker-on-rocky-linux-10/

900*80 ad

      1080*80 ad