+
argocd
+
+
circle
axum
โŠ‚
cargo
windows
+
fastapi
>=
+
+
haskell
strapi
phoenix
vb
+
+
ray
+
pnpm
+
webstorm
+
haiku
+
+
+
+
+
โІ
bsd
...
angular
โˆฉ
+
+
+
raspbian
+
+
+
+
react
+
+
+
deno
http
+
+
โ‰ 
*
//
webstorm
+
kotlin
+
+
phpstorm
fauna
c#
bash
โІ
+
+
supabase
xml
sklearn
{}
+
babel
+
+
+
+
+
css
||
c++
+
r
*
perl
alpine
+
vb
+
Back to Blog
๐Ÿณ Docker Installation on AlmaLinux: Complete Container Guide
Docker Installation Container Technology AlmaLinux Docker

๐Ÿณ Docker Installation on AlmaLinux: Complete Container Guide

Published Sep 14, 2025

Learn how to install and configure Docker on AlmaLinux 9 with this comprehensive step-by-step guide. Master container basics, security best practices, and real-world examples for developers and DevOps engineers.

14 min read
0 views
Table of Contents

๐Ÿณ Docker Installation on AlmaLinux: Complete Container Guide

Ready to dive into the world of containers? ๐Ÿš€ Today weโ€™ll install Docker on AlmaLinux and unlock the power of containerization! Whether youโ€™re a developer wanting to package applications or a DevOps engineer building scalable infrastructure, this guide makes Docker simple and accessible for everyone! ๐ŸŽฏ

๐Ÿค” Why is Docker on AlmaLinux Important?

Docker on AlmaLinux delivers amazing benefits:

  • ๐Ÿ“Œ Application portability - Run anywhere with consistent environments
  • ๐Ÿ”ง Resource efficiency - Use hardware more effectively than traditional VMs
  • ๐Ÿš€ Development speed - Build, test, and deploy applications faster
  • ๐Ÿ” Environment isolation - Keep applications separate and secure
  • โญ Microservices ready - Perfect foundation for modern architectures

๐ŸŽฏ What You Need

Before starting your Docker journey:

  • โœ… AlmaLinux 9 system (64-bit required)
  • โœ… Root or sudo access
  • โœ… At least 2GB RAM (4GB recommended)
  • โœ… Internet connection for downloading images
  • โœ… Basic command line knowledge (weโ€™ll guide you!)

๐Ÿ“ Step 1: Prepare AlmaLinux for Docker

Letโ€™s get your system ready for Docker! ๐Ÿ› ๏ธ

Update System and Install Prerequisites

# Update your AlmaLinux system
sudo dnf update -y

# Install required packages
sudo dnf install -y yum-utils device-mapper-persistent-data lvm2

# Install additional useful tools
sudo dnf install -y curl wget git nano

# Check system architecture (should be x86_64)
uname -m

# Verify kernel version (should be 3.10 or higher)
uname -r

echo "โœ… System prepared for Docker installation!"

Remove Old Docker Versions (if any)

# Remove any old Docker installations
sudo dnf remove -y docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

# Clean up old configuration
sudo rm -rf /var/lib/docker/
sudo rm -rf /etc/docker/

echo "โœ… Old Docker versions removed!"

Pro tip: ๐Ÿ’ก Itโ€™s normal if some packages arenโ€™t found - that just means they werenโ€™t installed before!

๐Ÿ”ง Step 2: Install Docker Engine

Now letโ€™s install the latest Docker Engine:

Add Docker Repository

# Add Docker's official repository
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo

# Verify repository was added
dnf repolist | grep docker

# Update package index
sudo dnf update -y

echo "โœ… Docker repository added successfully!"

Install Docker Engine and Tools

# Install Docker CE (Community Edition)
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Verify Docker is installed
docker --version

# Check installed components
rpm -qa | grep docker

# Verify containerd is installed
containerd --version

echo "โœ… Docker Engine installed successfully!"

Start and Enable Docker Service

# Start Docker service
sudo systemctl start docker

# Enable Docker to start at boot
sudo systemctl enable docker

# Check Docker service status
sudo systemctl status docker

# Verify Docker daemon is running
sudo docker info

echo "โœ… Docker service is running!"

Whatโ€™s happening: ๐Ÿ”„

  • Docker CE (Community Edition) is the free version of Docker
  • containerd is the container runtime that Docker uses
  • docker-buildx enables advanced build features
  • docker-compose-plugin lets you manage multi-container applications

๐ŸŒŸ Step 3: Configure Docker for Regular Users

Let Docker work without sudo:

Add User to Docker Group

# Create docker group (usually created automatically)
sudo groupadd docker

# Add your user to docker group
sudo usermod -aG docker $USER

# Check group membership
groups $USER

# Apply group changes (logout/login or use newgrp)
newgrp docker

# Test Docker without sudo
docker run hello-world

echo "โœ… Docker configured for regular user access!"

Configure Docker Daemon

# Create Docker daemon configuration
sudo mkdir -p /etc/docker

# Configure Docker daemon settings
sudo tee /etc/docker/daemon.json << 'EOF'
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  },
  "storage-driver": "overlay2",
  "storage-opts": [
    "overlay2.override_kernel_check=true"
  ],
  "live-restore": true,
  "default-runtime": "runc"
}
EOF

# Restart Docker to apply configuration
sudo systemctl restart docker

# Verify configuration
sudo docker info | grep -A 10 "Server:"

echo "โœ… Docker daemon configured!"

โœ… Step 4: Test and Verify Docker Installation

Letโ€™s make sure everything works perfectly:

Basic Docker Tests

# Test 1: Run hello-world container
docker run hello-world

# Test 2: Check Docker version
docker version

# Test 3: Display system information
docker info

# Test 4: List Docker images
docker images

# Test 5: List running containers
docker ps

echo "โœ… All basic tests passed!"

Container Management Tests

# Run an interactive container
docker run -it --name test-container alpine sh

# Inside the container, try some commands:
# ls -la
# echo "Hello from container!"
# exit

# List all containers (including stopped)
docker ps -a

# Remove the test container
docker rm test-container

# Download and run nginx web server
docker run -d --name web-server -p 8080:80 nginx

# Check if nginx is running
curl http://localhost:8080

# View container logs
docker logs web-server

# Stop and remove nginx container
docker stop web-server
docker rm web-server

echo "โœ… Container management tests completed!"

๐ŸŽฎ Quick Examples

Example 1: Development Environment Setup ๐Ÿ’ป

# Create a development workspace
mkdir ~/docker-projects && cd ~/docker-projects

# Run a Node.js development container
docker run -it --name nodejs-dev \
  -v $(pwd):/workspace \
  -p 3000:3000 \
  -w /workspace \
  node:18-alpine sh

# Inside the container, create a simple app:
echo 'console.log("Hello from Docker!");' > app.js
node app.js
exit

# Run the app from host
docker start nodejs-dev
docker exec nodejs-dev node app.js

# Clean up
docker stop nodejs-dev && docker rm nodejs-dev

echo "โœ… Development environment ready!"

Example 2: Database Server with Persistent Storage ๐Ÿ—„๏ธ

# Create data directory
mkdir -p ~/docker-data/mysql

# Run MySQL container with persistent storage
docker run -d \
  --name mysql-server \
  -e MYSQL_ROOT_PASSWORD=SecurePassword123! \
  -e MYSQL_DATABASE=testdb \
  -e MYSQL_USER=testuser \
  -e MYSQL_PASSWORD=TestPass123! \
  -v ~/docker-data/mysql:/var/lib/mysql \
  -p 3306:3306 \
  mysql:8.0

# Wait for MySQL to start (about 30 seconds)
sleep 30

# Test database connection
docker exec -it mysql-server mysql -u root -pSecurePassword123! -e "SHOW DATABASES;"

# Connect to the test database
docker exec -it mysql-server mysql -u testuser -pTestPass123! testdb -e "CREATE TABLE users (id INT, name VARCHAR(50)); INSERT INTO users VALUES (1, 'Docker User'); SELECT * FROM users;"

# View container resource usage
docker stats mysql-server --no-stream

# Stop MySQL (data persists in ~/docker-data/mysql)
docker stop mysql-server

echo "โœ… Database server with persistent storage working!"

Example 3: Web Application Stack ๐ŸŒ

# Create a simple web application stack
mkdir -p ~/web-app && cd ~/web-app

# Create a simple HTML file
cat > index.html << 'EOF'
<!DOCTYPE html>
<html>
<head>
    <title>My Docker App</title>
    <style>
        body { font-family: Arial; text-align: center; padding: 50px; }
        .container { background: #f4f4f4; padding: 20px; border-radius: 10px; }
    </style>
</head>
<body>
    <div class="container">
        <h1>๐Ÿณ Welcome to My Docker App!</h1>
        <p>This is running on AlmaLinux with Docker!</p>
        <p>Container ID: <span id="hostname"></span></p>
    </div>
    <script>
        document.getElementById('hostname').textContent = window.location.hostname;
    </script>
</body>
</html>
EOF

# Run nginx with custom content
docker run -d \
  --name my-web-app \
  -p 8080:80 \
  -v $(pwd):/usr/share/nginx/html:ro \
  nginx:alpine

# Test the web application
curl -s http://localhost:8080 | grep "Welcome to My Docker App"

# View in browser: http://your-server-ip:8080

# Monitor container performance
docker stats my-web-app --no-stream

# View access logs
docker logs my-web-app

echo "โœ… Web application stack deployed!"
echo "Visit: http://localhost:8080"

๐Ÿšจ Fix Common Problems

Problem 1: Permission Denied When Running Docker โŒ

Symptoms:

  • โ€œGot permission denied while trying to connect to the Docker daemonโ€
  • Docker commands require sudo

Try this:

# Check if you're in docker group
groups $USER | grep docker

# If not in group, add yourself
sudo usermod -aG docker $USER

# Apply group changes
newgrp docker

# Or logout and login again
# After logout/login, test:
docker run hello-world

Problem 2: Docker Service Wonโ€™t Start โŒ

Try this:

# Check Docker service status
sudo systemctl status docker

# Check Docker daemon logs
sudo journalctl -u docker -f

# Try starting Docker manually
sudo systemctl start docker

# If still failing, check system resources
df -h
free -h

# Restart Docker completely
sudo systemctl restart docker

Problem 3: Cannot Pull or Run Containers โŒ

Check these things:

# Test internet connectivity
ping -c 3 docker.io

# Check DNS resolution
nslookup docker.io

# Test Docker Hub connection
docker pull alpine:latest

# Check firewall settings
sudo firewall-cmd --list-all

# If behind corporate firewall, configure proxy:
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf << 'EOF'
[Service]
Environment="HTTP_PROXY=http://proxy.company.com:8080"
Environment="HTTPS_PROXY=http://proxy.company.com:8080"
EOF

sudo systemctl daemon-reload
sudo systemctl restart docker

๐Ÿ“‹ Simple Commands Summary

TaskCommand
๐Ÿ‘€ Check Docker versiondocker --version
๐Ÿ”ง Run containerdocker run image-name
๐Ÿš€ List running containersdocker ps
๐Ÿ›‘ Stop containerdocker stop container-name
โ™ป๏ธ Remove containerdocker rm container-name
๐Ÿ“Š List imagesdocker images
โœ… Remove imagedocker rmi image-name

๐Ÿ’ก Tips for Success

  1. Start simple ๐ŸŒŸ - Begin with basic containers before complex applications
  2. Use official images ๐Ÿ” - Always prefer official Docker Hub images
  3. Manage resources ๐Ÿš€ - Monitor container CPU and memory usage
  4. Version control ๐Ÿ“ - Tag your custom images with meaningful versions
  5. Security first ๐Ÿ”„ - Keep Docker and container images updated

๐Ÿ† What You Learned

Congratulations! Now you can:

  • โœ… Install Docker Engine on AlmaLinux from official repositories
  • โœ… Configure Docker for secure, rootless operation
  • โœ… Run, manage, and troubleshoot containers effectively
  • โœ… Create development environments and web application stacks
  • โœ… Implement persistent storage and container networking

๐ŸŽฏ Why This Matters

Your Docker setup on AlmaLinux provides:

  • ๐Ÿš€ Modern development workflow with containerized applications
  • ๐Ÿ” Production-ready platform for deploying microservices
  • ๐Ÿ“Š Consistent environments across development, testing, and production
  • โšก Resource efficiency compared to traditional virtual machines

Remember: Docker is not just a tool - itโ€™s a complete paradigm shift that enables you to build, ship, and run applications anywhere with confidence! โญ

Youโ€™ve successfully mastered Docker installation on AlmaLinux! You now have the foundation for modern containerized applications, microservices architectures, and cloud-native development! ๐Ÿ™Œ