How To Install Docker on AlmaLinux 10
Docker has revolutionized application deployment through containerization technology, enabling developers and system administrators to create, deploy, and manage applications with unprecedented efficiency and consistency. AlmaLinux 10, as an enterprise-grade Linux distribution and CentOS successor, provides an excellent foundation for Docker containerization. This comprehensive guide walks you through the complete process of installing Docker on AlmaLinux 10, from initial system preparation to advanced configuration options. Whether you’re a developer seeking to streamline your workflow or a system administrator implementing containerized infrastructure, this tutorial ensures a successful Docker deployment on your AlmaLinux environment.
Prerequisites and System Requirements
Before beginning the Docker installation process, your AlmaLinux 10 system must meet specific requirements to ensure optimal performance and compatibility. Your system needs a minimum of 2GB RAM and 2 CPU cores, though 4GB RAM is recommended for production environments. Ensure you have at least 10GB of available disk space for Docker images and containers.
The kernel version requirement is crucial for Docker functionality. AlmaLinux 10 should have kernel version 3.10 or higher, which is standard for modern AlmaLinux releases. You’ll need root access or sudo privileges throughout this installation process. An active internet connection is essential for downloading Docker packages and repository configurations from the official Docker registry.
Your system should be running AlmaLinux 10 with full administrative access. If you’re working on a virtual private server (VPS), ensure your hosting provider supports containerization technologies. These requirements form the foundation for a stable Docker installation that will serve your containerization needs effectively.
Step 1: System Preparation and Updates
System preparation begins with ensuring your AlmaLinux 10 installation is current with the latest security patches and package updates. Start by refreshing your package repositories and applying all available updates using the DNF package manager.
Execute the following commands to update your system comprehensively:
sudo dnf --refresh update
sudo dnf upgrade
These commands refresh the package metadata and upgrade all installed packages to their latest versions. The update process may take several minutes depending on your system’s current state and internet connection speed.
Next, install essential utilities that Docker installation requires. The yum-utils
package provides repository management capabilities, while additional dependencies ensure proper Docker functionality:
sudo dnf install yum-utils device-mapper-persistent-data lvm2
Remove any conflicting packages that might interfere with Docker installation. AlmaLinux systems often come with Podman and Buildah pre-installed, which can create dependency conflicts:
sudo dnf remove podman buildah runc
This removal step is critical because these container technologies can create package conflicts that prevent Docker from installing correctly. After removing conflicting packages, your system is prepared for Docker installation.
Step 2: Adding Docker Official Repository
Docker packages aren’t available in AlmaLinux default repositories, requiring you to add the official Docker Community Edition repository. Since AlmaLinux is CentOS-compatible, we use the CentOS Docker repository for package installation.
Import the Docker GPG key to verify package authenticity during installation:
sudo rpm --import https://download.docker.com/linux/centos/gpg
Add the Docker CE repository using the DNF configuration manager:
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
This command adds the official Docker repository configuration to your system. The repository provides access to the latest stable Docker Community Edition packages, ensuring you receive official Docker releases with proper support and security updates.
Verify the repository addition by listing available repositories:
sudo dnf repolist
You should see the Docker CE repository listed among your configured package sources. This confirmation ensures the repository is properly configured and accessible for package installation.
Step 3: Installing Docker Engine and Components
With the repository configured, install the complete Docker package suite. Docker installation requires multiple components working together to provide full containerization functionality.
Install Docker Community Edition with all essential components:
sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin
This command installs four critical components:
- docker-ce: The main Docker Community Edition engine providing core containerization functionality
- docker-ce-cli: Command-line interface tools for Docker management and operations
- containerd.io: Container runtime that manages container lifecycle and execution
- docker-compose-plugin: Docker Compose functionality for multi-container applications
During installation, you’ll encounter a GPG key verification prompt. Accept the Docker GPG key by typing ‘y’ when prompted. This verification ensures package authenticity and security.
The installation process downloads and configures all necessary dependencies automatically. DNF resolves dependency conflicts and installs additional packages required for Docker functionality, including SELinux policies and networking components.
Installation typically takes 5-10 minutes depending on your internet connection speed. Monitor the output for any error messages or dependency conflicts that might require attention.
Step 4: Starting and Enabling Docker Service
After successful package installation, configure Docker services for immediate use and automatic startup. Docker requires the daemon service to be running before you can create or manage containers.
Start the Docker service immediately:
sudo systemctl start docker
Enable Docker for automatic startup at system boot:
sudo systemctl enable docker
Verify the Docker service status to confirm successful activation:
sudo systemctl status docker
The status output should show “active (running)” indicating Docker is operational. If the service fails to start, check system logs for error messages:
sudo journalctl -u docker.service
The Docker daemon must be running for all Docker operations. These systemctl commands ensure Docker starts automatically after system reboots, maintaining containerization capabilities without manual intervention.
Step 5: Post-Installation Configuration
Configure user permissions to allow non-root Docker access. By default, Docker requires root privileges, but adding users to the docker group enables convenient command execution without sudo.
Add your current user to the docker group:
sudo usermod -aG docker $USER
Activate the group membership immediately without logging out:
newgrp docker
This configuration allows running Docker commands without sudo prefixes. However, understand that docker group membership grants root-equivalent privileges, as Docker can access the entire filesystem through container mounts.
For additional security, consider creating dedicated Docker users rather than adding administrative accounts to the docker group. This approach limits potential security exposure while maintaining operational convenience.
Configure Docker daemon settings if your environment requires specific configurations. The daemon configuration file /etc/docker/daemon.json
allows customization of storage drivers, networking options, and security settings according to your infrastructure requirements.
Step 6: Testing Docker Installation
Verify your Docker installation with comprehensive testing to ensure all components function correctly. Testing confirms that Docker can pull images, create containers, and manage containerized applications successfully.
Check the Docker version to confirm successful installation:
docker --version
Run the Docker hello-world container to test complete functionality:
docker run hello-world
This command downloads the hello-world image from Docker Hub and creates a test container. Successful execution confirms that Docker can communicate with the Docker Hub registry, download images, and execute containers properly.
Test additional Docker commands to verify full functionality:
docker info
docker images
docker ps -a
The docker info
command displays comprehensive system information including Docker version, storage driver, and system capabilities. The docker images
command lists downloaded container images, while docker ps -a
shows all containers including stopped ones.
These tests confirm that Docker installation is complete and functional. Any errors during testing indicate configuration issues requiring troubleshooting before proceeding with container deployment.
Troubleshooting Common Installation Issues
Address common Docker installation problems that may occur on AlmaLinux 10 systems. Understanding these issues helps resolve installation obstacles quickly and efficiently.
Permission Denied Errors: If Docker commands fail with permission errors, verify user group membership and restart your shell session. Log out and log back in to activate group changes, or use newgrp docker
to refresh group membership immediately.
Repository Connection Problems: Network connectivity issues can prevent repository access. Verify internet connectivity and DNS resolution. Check firewall settings that might block repository access on ports 80 and 443.
Package Conflict Resolution: Dependency conflicts between Docker and existing packages require careful resolution. Use dnf remove
to uninstall conflicting packages before Docker installation. The --allowerasing
flag can help resolve complex dependency situations:
sudo dnf install docker-ce --allowerasing
SELinux Configuration Issues: AlmaLinux enforces SELinux policies that may interfere with Docker operations. Check SELinux status and configure appropriate policies:
sestatus
sudo setsebool -P container_manage_cgroup on
Service Startup Failures: If Docker service fails to start, examine system logs for specific error messages. Common issues include insufficient system resources, conflicting services, or corrupted installation files.
Container Runtime Errors: Problems with containerd or container execution often relate to kernel compatibility or resource limitations. Verify kernel version compatibility and available system resources.
Log file locations for troubleshooting include /var/log/docker.log
and systemd journal entries accessible through journalctl -u docker.service
. These logs provide detailed information about Docker daemon operations and error conditions.
Security Best Practices and Recommendations
Implement security measures to protect your Docker installation and containerized applications. Docker security requires attention to daemon configuration, container isolation, and access controls.
Configure Docker daemon security settings through /etc/docker/daemon.json
. Enable user namespace remapping to improve container isolation:
{
"userns-remap": "default",
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
Implement container resource limits to prevent resource exhaustion attacks. Use Docker’s built-in capabilities to restrict container access to system resources and sensitive directories.
Regular security updates are essential for maintaining Docker security. Schedule automatic updates for Docker packages and base container images. Monitor security advisories from Docker and AlmaLinux for critical security patches.
Enable Docker Content Trust to verify image integrity and authenticity. This feature ensures that downloaded images haven’t been tampered with during distribution.
Consider implementing additional security tools like AppArmor or SELinux profiles specifically designed for container workloads. These tools provide additional layers of security beyond Docker’s default isolation mechanisms.
Advanced Configuration Options
Optimize Docker for production environments through advanced configuration options. These settings improve performance, monitoring, and integration with existing infrastructure.
Configure custom storage drivers based on your filesystem and performance requirements. The overlay2 storage driver is recommended for most AlmaLinux installations:
{
"storage-driver": "overlay2",
"storage-opts": [
"overlay2.override_kernel_check=true"
]
}
Implement comprehensive logging strategies for container monitoring and debugging. Configure centralized logging with rsyslog or journald integration to capture container output alongside system logs.
Set up Docker daemon resource limits to prevent container workloads from overwhelming system resources. Configure memory and CPU limits appropriate for your hardware and application requirements.
Integrate Docker with existing AlmaLinux infrastructure including monitoring systems, backup solutions, and configuration management tools. This integration ensures Docker operations align with established operational procedures.
Configure networking options for complex container deployments. Custom bridge networks, overlay networks, and integration with external networking infrastructure require careful planning and configuration.
Uninstalling Docker (Optional)
Complete Docker removal may be necessary for troubleshooting or transitioning to alternative container platforms. Proper uninstallation ensures clean system state without residual configuration files.
Stop all running containers and remove container images:
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
docker rmi $(docker images -q)
Remove Docker packages completely:
sudo dnf remove docker-ce docker-ce-cli containerd.io docker-compose-plugin
Clean up Docker directories and configuration files:
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
sudo rm -rf /etc/docker
Remove user group associations and repository configurations to complete the cleanup process. This thorough removal ensures no Docker components remain on your system.
Congratulations! You have successfully installed Docker. Thanks for using this tutorial for installing the Docker containers on your AlmaLinux OS 10 system. For additional or useful information, we recommend you check the official Docker website.