How To Install Docker on Rocky Linux 10
In this tutorial, we will show you how to install Docker on Rocky Linux 10. The containerization revolution has transformed modern software deployment, with Docker leading the charge as the most widely adopted container platform. Rocky Linux 10, as a stable enterprise-grade operating system, provides an excellent foundation for running containerized applications in production environments.
This comprehensive guide will walk you through every step of installing Docker on Rocky Linux 10, from initial system preparation to advanced configuration and troubleshooting. Whether you’re a system administrator managing enterprise infrastructure or a developer setting up a local development environment, this tutorial provides the detailed instructions you need for a successful Docker installation.
Rocky Linux’s compatibility with CentOS-based repositories makes it an ideal choice for Docker deployments, offering long-term support and enterprise-level stability. By the end of this guide, you’ll have a fully functional Docker installation ready for container management and application deployment.
Understanding Docker and Rocky Linux 10 Ecosystem
Docker Architecture Overview
Docker operates on a client-server architecture that fundamentally changes how applications are packaged and deployed. The Docker Engine serves as the core component, consisting of a daemon process (dockerd) that manages containers, images, networks, and storage volumes. The Docker client communicates with this daemon through a REST API, enabling seamless container lifecycle management.
Unlike traditional virtual machines that require separate operating system instances, Docker containers share the host kernel while maintaining complete application isolation. This approach dramatically reduces resource overhead and enables faster startup times. Container images serve as lightweight, portable packages containing everything needed to run an application, including code, runtime, system tools, libraries, and settings.
Rocky Linux 10 and Container Compatibility
Rocky Linux 10 inherits the robust foundation of Red Hat Enterprise Linux, making it exceptionally well-suited for containerized workloads. The distribution’s binary compatibility with RHEL ensures that Docker packages designed for enterprise Linux environments function seamlessly. This compatibility extends to package management, security frameworks, and system libraries that Docker relies upon.
The enterprise Linux ecosystem provides several advantages for Docker deployments, including proven stability, comprehensive security features, and extensive community support. Rocky Linux’s commitment to long-term support aligns perfectly with Docker’s enterprise adoption patterns, where stability and predictability are paramount.
Prerequisites and System Requirements
Hardware Requirements
A successful Docker installation on Rocky Linux 10 requires adequate system resources to support both the host operating system and containerized applications. The minimum system specifications include 2GB of RAM and 20GB of available disk space, though production environments typically require significantly more resources.
For production deployments, consider allocating at least 4GB of RAM and 100GB of storage to accommodate multiple container images and running instances. Storage performance becomes particularly important when managing large container registries or data-intensive applications.
Software Requirements
Before beginning the Docker installation process, verify that your Rocky Linux 10 system is properly configured and up to date. You’ll need administrative privileges through sudo access to install packages and manage system services. Network connectivity is essential for downloading Docker packages and container images from remote repositories.
Ensure your system has access to standard Rocky Linux repositories and can reach external package sources. Firewall configurations should allow outbound HTTPS connections on port 443 for secure package downloads.
Pre-Installation System Preparation
System preparation involves updating existing packages and verifying compatibility with Docker requirements. SELinux, Rocky Linux’s security framework, works seamlessly with Docker when properly configured, providing an additional layer of container security.
Method 1: Installing Docker Using DNF Package Manager
Step 1: System Update and Preparation
Begin the Docker installation process by updating your Rocky Linux 10 system to ensure all packages are current and security patches are applied. Open a terminal session and execute the following command:
sudo dnf update
This command downloads and installs the latest package updates, which may take several minutes depending on your system’s current state and available updates. During this process, DNF will display a summary of packages to be updated and request confirmation before proceeding.
After the update completes, install essential development tools and dependencies that Docker may require:
sudo dnf install -y yum-utils device-mapper-persistent-data lvm2
These packages provide critical functionality for Docker’s storage drivers and repository management capabilities.
Step 2: Adding Docker Repository
Rocky Linux doesn’t include Docker packages in its default repositories, necessitating the addition of Docker’s official repository. The Docker CE repository for CentOS provides fully compatible packages for Rocky Linux systems.
Add the Docker repository using the DNF configuration manager:
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
This command downloads the repository configuration file and integrates it with your system’s package management infrastructure. The output confirms successful repository addition:
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
Refresh the package database to ensure DNF recognizes the newly added repository:
sudo dnf update
Step 3: Installing Docker Packages
Docker Community Edition consists of several interconnected packages that work together to provide complete container management functionality. Install the core Docker packages using a single DNF command:
sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Each package serves a specific purpose in the Docker ecosystem:
- docker-ce: The primary Docker Engine package containing the daemon (dockerd) responsible for container management
- docker-ce-cli: Provides the command-line interface for interacting with Docker
- containerd.io: Supplies the container runtime environment for executing containers
- docker-buildx-plugin: Enables advanced image building capabilities with multi-platform support
- docker-compose-plugin: Integrates Docker Compose functionality for multi-container applications
The installation process automatically resolves dependencies and may install additional supporting packages. DNF displays a comprehensive summary of all packages scheduled for installation before proceeding.
Step 4: Service Configuration and Management
After successful package installation, configure Docker to start automatically during system boot and initialize the service immediately:
sudo systemctl --now enable docker
This combined command both enables the Docker service for automatic startup and starts it immediately. Alternatively, you can perform these actions separately:
sudo systemctl enable docker
sudo systemctl start docker
Verify that Docker is running correctly by checking the service status:
sudo systemctl status docker
A successful installation displays output indicating the service is “active (running)” with recent log entries showing daemon initialization.
Post-Installation Configuration
Setting Up Non-Root User Access
By default, Docker commands require root privileges, necessitating sudo for every operation. Configure non-root user access to streamline Docker usage while maintaining system security.
Add your current user to the docker group:
sudo usermod -aG docker $(whoami)
For adding a specific user account:
sudo usermod -aG docker username
Group membership changes require a new login session to take effect. Log out and log back in, then verify group membership:
id $USER
The output should include “docker” among the listed groups. This configuration allows docker commands without sudo while maintaining appropriate access controls.
Docker Service Optimization
Optimize Docker’s performance by configuring daemon options specific to Rocky Linux environments. Create or modify the Docker daemon configuration file:
sudo mkdir -p /etc/docker
sudo vim /etc/docker/daemon.json
Add performance-oriented configuration options:
{
"storage-driver": "overlay2",
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
This configuration optimizes storage performance and implements log rotation to prevent disk space issues.
Security Hardening
Enhance Docker security by configuring appropriate socket permissions and container isolation settings. Docker’s integration with SELinux provides additional security layers for containerized applications.
Verify SELinux status and Docker compatibility:
sestatus
sudo setsebool -P container_manage_cgroup on
This configuration ensures proper SELinux integration while maintaining container functionality.
Installation Verification and Testing
Basic Docker Functionality Test
Confirm Docker installation success by running the official test container:
docker run hello-world
This command downloads a minimal test image and executes a container that displays a welcome message. Successful execution indicates proper Docker installation, image pulling capabilities, and container execution functionality.
The hello-world container produces output explaining Docker’s operation sequence, from image download through container execution and cleanup.
Advanced Testing Procedures
Conduct comprehensive testing using a more feature-rich container image:
docker run -it busybox sh
This command launches an interactive BusyBox container, providing a minimal Linux environment for testing container networking, filesystem access, and process isolation. Use basic commands within the container to verify functionality:
# Inside the container
ls /
ps aux
ip addr show
exit
Test image management capabilities:
docker images
docker ps -a
docker system info
These commands display available images, container history, and comprehensive system information.
Alternative Installation Methods
Installing Specific Docker Versions
Production environments often require specific Docker versions for compatibility or compliance reasons. List available Docker versions:
dnf list docker-ce --showduplicates | sort -r
Install a specific version using version notation:
sudo dnf install docker-ce-20.10.17 docker-ce-cli-20.10.17 containerd.io
This approach provides precise version control for environments requiring specific Docker releases.
Offline Installation Considerations
Air-gapped or restricted network environments require alternative installation strategies. Download required packages to a connected system, then transfer them to the target environment:
dnf download docker-ce docker-ce-cli containerd.io
sudo dnf localinstall *.rpm
This method enables Docker installation in isolated environments while maintaining security protocols.
Troubleshooting Common Issues
Installation Problems
Repository access issues frequently occur due to network restrictions or DNS problems. Verify network connectivity and DNS resolution:
ping download.docker.com
nslookup download.docker.com
GPG key verification failures require manual key import:
sudo rpm --import https://download.docker.com/linux/centos/gpg
Package dependency conflicts typically resolve through clean package cache:
sudo dnf clean all
sudo dnf makecache
Service and Runtime Issues
Docker daemon startup failures often relate to configuration errors or resource constraints. Examine system logs for diagnostic information:
sudo journalctl -u docker.service -f
Storage driver incompatibilities require daemon configuration adjustments. Modify /etc/docker/daemon.json
to specify appropriate storage drivers for your environment.
Permission denied errors when accessing Docker sockets indicate improper user group membership or socket permission issues:
sudo chmod 666 /var/run/docker.sock
User Access and Permission Issues
Docker group membership problems require verification and potential re-login. Confirm group assignment and refresh user sessions to apply changes.
SELinux context issues may prevent container execution. Verify SELinux policies and Docker integration:
sudo setsebool -P container_manage_cgroup on
sudo setsebool -P virt_use_execmem on
Docker Management Best Practices on Rocky Linux 10
Performance Optimization
Implement resource allocation strategies to maximize Docker performance on Rocky Linux systems. Configure appropriate memory limits, CPU quotas, and storage optimization:
docker run --memory="1g" --cpus="1.5" application:latest
Regular maintenance includes image cleanup and volume management:
docker system prune -a
docker volume prune
Maintenance and Updates
Establish regular Docker update procedures to maintain security and performance. Monitor Docker releases and plan updates during maintenance windows:
sudo dnf update docker-ce docker-ce-cli containerd.io
Implement backup strategies for Docker volumes and configuration files to ensure data protection and disaster recovery capabilities.
Next Steps and Advanced Usage
Docker Compose Integration
Docker Compose simplifies multi-container application management through declarative YAML configuration files. The docker-compose-plugin package provides integrated Compose functionality.
Create a sample docker-compose.yml
file:
version: '3.8'
services:
web:
image: nginx:alpine
ports:
- "80:80"
database:
image: postgres:13
environment:
POSTGRES_PASSWORD: example
Deploy the application stack:
docker compose up -d
Production Deployment Considerations
Enterprise Docker deployments require additional considerations including container orchestration, monitoring, and security hardening. Kubernetes integration provides scalable container orchestration for complex applications.
Implement comprehensive logging and monitoring solutions to maintain visibility into containerized applications. Consider tools like Prometheus, Grafana, and ELK stack for comprehensive observability.
Security scanning and vulnerability management become critical in production environments. Integrate container scanning tools into CI/CD pipelines to identify and remediate security issues before deployment.
Congratulations! You have successfully installed Docker. Thanks for using this tutorial for installing Docker CE on your Rocky Linux 10 system. For additional help or useful information, we recommend you check the official Docker website.