rb
+
react
0x
terraform
gcp
mysql
+
pascal
wasm
macos
+
+
+
===
+
crystal
+
{}
<=
abap
โˆช
elasticsearch
+
+
linux
+
azure
?
prometheus
bun
solid
+
termux
cypress
marko
redis
ubuntu
+
websocket
+
+
clion
+
+
+
>=
atom
crystal
+
zorin
groovy
+
pytest
+
adonis
+
lit
keras
+
travis
+
+
koa
+
+
+
=
+
#
cosmos
+
=>
vault
+
bundler
xgboost
+
+
+
bsd
0x
+
+
https
+
+
npm
sublime
{}
Back to Blog
๐Ÿณ Docker Container Installation and Management on AlmaLinux
docker containers almalinux

๐Ÿณ Docker Container Installation and Management on AlmaLinux

Published Sep 14, 2025

Master Docker containers on AlmaLinux! Complete guide to install, manage, and deploy applications with Docker. Perfect for developers and DevOps engineers looking to modernize their workflow.

17 min read
0 views
Table of Contents

๐Ÿณ Docker Container Installation and Management on AlmaLinux

Ready to revolutionize how you deploy applications? ๐Ÿš€ Docker containers are the game-changer that transformed modern software development! In this comprehensive guide, weโ€™ll install Docker on AlmaLinux and teach you everything from basic container operations to advanced management techniques. Letโ€™s containerize your world! โœจ

๐Ÿค” Why is Docker Important?

Docker containers are like magic boxes for your applications! ๐Ÿ“ฆ Hereโ€™s why millions of developers and companies love Docker:

  • ๐Ÿš€ Lightning Fast Deployment: Deploy applications in seconds, not hours
  • ๐Ÿ”„ Consistency Everywhere: โ€œIt works on my machineโ€ becomes โ€œIt works everywhereโ€
  • ๐Ÿ’ฐ Cost Efficient: Run more applications on less hardware
  • ๐Ÿ›ก๏ธ Isolated Security: Applications canโ€™t interfere with each other
  • ๐Ÿ“ˆ Easy Scaling: Scale up or down instantly based on demand
  • ๐Ÿ”ง DevOps Ready: Perfect for CI/CD pipelines and automation
  • ๐ŸŒ Universal Platform: Run the same containers on any system
  • ๐ŸŽฏ Microservices: Build modern, distributed applications

Think of Docker as shipping containers for software - standardized, portable, and efficient! ๐Ÿšข

๐ŸŽฏ What You Need

Letโ€™s make sure youโ€™re ready for Docker mastery! โœ…

  • โœ… AlmaLinux 8 or 9 server with internet connection
  • โœ… At least 4GB RAM (8GB recommended for multiple containers)
  • โœ… 20GB free disk space (containers need storage)
  • โœ… sudo privileges on your system
  • โœ… Basic understanding of Linux command line
  • โœ… CPU with virtualization support (most modern CPUs have this)
  • โœ… Web browser for testing containerized applications
  • โœ… 20 minutes of focused time and enthusiasm! ๐ŸŽ‰

Donโ€™t worry if containers are new to you - weโ€™ll start from the basics! ๐ŸŒŸ

๐Ÿ“ Step 1: Prepare Your System

First, letโ€™s get your AlmaLinux system ready for Docker! ๐ŸŽฏ

# Update your system packages
sudo dnf update -y

# Install required packages for Docker repository
sudo dnf install -y dnf-plugins-core

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

Perfect! ๐ŸŽ‰ Your system is now clean and ready for Docker installation.

๐Ÿ”ง Step 2: Add Docker Repository

Letโ€™s add the official Docker repository to get the latest version! ๐Ÿ“ฆ

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

# Update package cache with new repository
sudo dnf update -y

# List available Docker versions (optional, for verification)
dnf list docker-ce --showduplicates | sort -r

Excellent! ๐ŸŽฏ Now we can install Docker from the official repository.

๐ŸŒŸ Step 3: Install Docker Engine

Time to install the star of the show - Docker! ๐ŸŒŸ

# Install Docker Engine, CLI, and containerd
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Start Docker service
sudo systemctl start docker

# Enable Docker to start automatically on boot
sudo systemctl enable docker

# Check Docker service status
sudo systemctl status docker

Expected Output:

โ— docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
   Active: active (running) since Mon 2025-09-14 10:00:00 UTC

Amazing! ๐ŸŽ‰ Docker is now running on your system!

โœ… Step 4: Configure Docker for Non-Root User

Letโ€™s configure Docker so you donโ€™t need sudo for every command! ๐Ÿ”

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

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

# Verify Docker installation
docker --version

# Test Docker with hello-world container
docker run hello-world

Expected Output:

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

Perfect! โœ… Docker is working perfectly!

๐Ÿ”ง Step 5: Basic Docker Commands

Letโ€™s learn the essential Docker commands every developer needs! ๐Ÿ’ช

Container Lifecycle Management

# List running containers
docker ps

# List all containers (running and stopped)
docker ps -a

# Run a container interactively
docker run -it ubuntu:latest /bin/bash

# Run a container in background (detached mode)
docker run -d nginx:latest

# Stop a running container
docker stop CONTAINER_ID

# Start a stopped container
docker start CONTAINER_ID

# Remove a container
docker rm CONTAINER_ID

Image Management

# List downloaded images
docker images

# Download an image without running it
docker pull nginx:latest

# Remove an image
docker rmi IMAGE_ID

# Build an image from Dockerfile
docker build -t myapp:latest .

# Tag an image
docker tag SOURCE_IMAGE:TAG TARGET_IMAGE:TAG

Great job! ๐ŸŽฏ Youโ€™re mastering Docker commands!

๐ŸŒŸ Step 6: Create Your First Container

Letโ€™s create and manage real containers with practical examples! ๐ŸŽฎ

Example 1: Web Server Container

# Run Nginx web server container
docker run -d -p 8080:80 --name my-webserver nginx:latest

# Check if container is running
docker ps

# Test the web server
curl http://localhost:8080

# View container logs
docker logs my-webserver

# Stop and remove the container
docker stop my-webserver
docker rm my-webserver

Example 2: Database Container

# Run MySQL database container
docker run -d \
  --name my-database \
  -e MYSQL_ROOT_PASSWORD=mypassword \
  -e MYSQL_DATABASE=testdb \
  -p 3306:3306 \
  mysql:8.0

# Connect to the database
docker exec -it my-database mysql -uroot -pmypassword

# Inside MySQL prompt, create a table:
# USE testdb;
# CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(50));
# EXIT;

Example 3: Application Development Container

# Run Node.js development environment
docker run -it \
  --name my-dev-env \
  -v $(pwd):/workspace \
  -w /workspace \
  -p 3000:3000 \
  node:18 \
  /bin/bash

# Inside the container, you can:
# npm init -y
# npm install express
# Create and run Node.js applications

Awesome! ๐Ÿš€ Youโ€™re now running real applications in containers!

โœ… Step 7: Docker Compose for Multi-Container Applications

Docker Compose helps manage multiple containers together! ๐ŸŽญ

Install Docker Compose (if not already installed)

# Verify Docker Compose is installed
docker compose version

# If not installed, install it
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Create a Multi-Container Application

# Create project directory
mkdir my-app && cd my-app

# Create docker-compose.yml file
cat > docker-compose.yml << 'EOF'
version: '3.8'

services:
  web:
    image: nginx:latest
    ports:
      - "8080:80"
    volumes:
      - ./html:/usr/share/nginx/html
    depends_on:
      - api

  api:
    image: node:18
    working_dir: /app
    volumes:
      - ./api:/app
    ports:
      - "3000:3000"
    command: "npm start"
    environment:
      - NODE_ENV=development

  database:
    image: mysql:8.0
    environment:
      MYSQL_ROOT_PASSWORD: mypassword
      MYSQL_DATABASE: myapp
    ports:
      - "3306:3306"
    volumes:
      - db_data:/var/lib/mysql

volumes:
  db_data:
EOF

# Create directories
mkdir -p html api

# Create simple HTML file
echo '<h1>๐Ÿš€ My Containerized App!</h1>' > html/index.html

# Start all services
docker compose up -d

# View running services
docker compose ps

# Stop all services
docker compose down

Fantastic! ๐ŸŽ‰ Youโ€™ve created a complete multi-container application!

๐ŸŽฎ Quick Examples

Letโ€™s practice with some real-world scenarios! ๐ŸŽฏ

Example 1: WordPress with Database

# Create WordPress stack
mkdir wordpress-app && cd wordpress-app

cat > docker-compose.yml << 'EOF'
version: '3.8'

services:
  wordpress:
    image: wordpress:latest
    ports:
      - "8080:80"
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpresspass
      WORDPRESS_DB_NAME: wordpress
    depends_on:
      - db

  db:
    image: mysql:8.0
    environment:
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpresspass
      MYSQL_ROOT_PASSWORD: rootpass
    volumes:
      - db_data:/var/lib/mysql

volumes:
  db_data:
EOF

# Start WordPress
docker compose up -d

# Access WordPress at http://localhost:8080
echo "๐ŸŽ‰ WordPress is ready at http://localhost:8080"

Example 2: Development Environment

# Create development stack
mkdir dev-stack && cd dev-stack

cat > docker-compose.yml << 'EOF'
version: '3.8'

services:
  redis:
    image: redis:alpine
    ports:
      - "6379:6379"

  postgres:
    image: postgres:15
    environment:
      POSTGRES_DB: devdb
      POSTGRES_USER: dev
      POSTGRES_PASSWORD: devpass
    ports:
      - "5432:5432"

  adminer:
    image: adminer
    ports:
      - "8080:8080"
    depends_on:
      - postgres
EOF

# Start development stack
docker compose up -d

echo "๐Ÿ› ๏ธ Development stack ready!"
echo "Database admin: http://localhost:8080"
echo "PostgreSQL: localhost:5432"
echo "Redis: localhost:6379"

Example 3: Monitoring Stack

# Create monitoring directory
mkdir monitoring && cd monitoring

# Simple monitoring with Nginx stats
docker run -d \
  --name nginx-monitor \
  -p 8080:80 \
  -v /var/log:/var/log:ro \
  nginx:alpine

# Monitor container resources
docker stats nginx-monitor

# View container processes
docker top nginx-monitor

๐Ÿšจ Fix Common Problems

Having Docker issues? Letโ€™s troubleshoot together! ๐Ÿ”ง

Problem 1: Permission Denied Errors

Symptoms: โ€œpermission denied while trying to connect to Docker daemonโ€

Solution:

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

# Apply changes immediately
newgrp docker

# Or logout and login again
# Verify group membership
groups

# Test Docker command
docker ps

Problem 2: Container Wonโ€™t Start

Symptoms: Container exits immediately or fails to start

Solution:

# Check container logs
docker logs CONTAINER_NAME

# Run container interactively to debug
docker run -it IMAGE_NAME /bin/bash

# Check if port is already in use
sudo netstat -tlnp | grep :8080

# Kill process using the port
sudo kill -9 PID_NUMBER

Problem 3: Out of Disk Space

Symptoms: โ€œno space left on deviceโ€ errors

Solution:

# Clean up unused containers
docker container prune -f

# Clean up unused images
docker image prune -f

# Clean up unused volumes
docker volume prune -f

# Clean up everything unused
docker system prune -a -f

# Check disk usage
docker system df

Problem 4: Network Connection Issues

Symptoms: Containers canโ€™t connect to each other

Solution:

# List Docker networks
docker network ls

# Create custom network
docker network create myapp-network

# Run containers on same network
docker run -d --network myapp-network --name app1 nginx
docker run -d --network myapp-network --name app2 redis

# Test connectivity between containers
docker exec app1 ping app2

๐Ÿ“‹ Simple Commands Summary

Your Docker command cheat sheet! ๐Ÿ“š

TaskCommandPurpose
List Containersdocker psShow running containers
List All Containersdocker ps -aShow all containers
Run Containerdocker run -d nginxStart container in background
Stop Containerdocker stop NAMEStop running container
Remove Containerdocker rm NAMEDelete container
List Imagesdocker imagesShow downloaded images
Pull Imagedocker pull IMAGEDownload image
View Logsdocker logs NAMEShow container logs
Execute Commanddocker exec -it NAME bashRun command in container
Clean Updocker system prune -fRemove unused resources

๐Ÿ’ก Tips for Success

Master Docker with these expert tips! ๐ŸŒŸ

  • ๐Ÿท๏ธ Use Tags: Always specify image versions (nginx:1.21, not nginx:latest)
  • ๐Ÿ“ฆ Layer Efficiently: Combine RUN commands in Dockerfiles to reduce image size
  • ๐Ÿ”’ Security First: Donโ€™t run containers as root, use official images
  • ๐Ÿ“Š Monitor Resources: Use docker stats to watch CPU/memory usage
  • ๐Ÿงน Clean Regularly: Run docker system prune weekly to free space
  • ๐Ÿ“ Document Everything: Keep docker-compose.yml files well-commented
  • ๐Ÿ”„ Use Volumes: Persist data with volumes, not container filesystem
  • ๐ŸŒ Network Properly: Use custom networks for multi-container apps
  • ๐Ÿš€ Optimize Images: Use multi-stage builds for smaller production images
  • ๐Ÿ“ˆ Scale Smart: Use Docker Swarm or Kubernetes for production scaling

๐Ÿ† What You Learned

Look at your amazing Docker achievements! ๐ŸŽ‰

  • โœ… Installed Docker Engine on AlmaLinux with official repository
  • โœ… Configured user permissions for seamless Docker usage
  • โœ… Mastered basic commands for container lifecycle management
  • โœ… Created real containers running web servers and databases
  • โœ… Built multi-container apps with Docker Compose
  • โœ… Learned troubleshooting techniques for common Docker issues
  • โœ… Deployed practical examples like WordPress and development stacks
  • โœ… Gained container expertise thatโ€™s highly valued in the industry
  • โœ… Understood Docker networking and volume management
  • โœ… Acquired DevOps skills essential for modern development

Youโ€™re now a Docker containerization expert! ๐ŸŒŸ

๐ŸŽฏ Why This Matters

Your Docker skills open incredible opportunities! ๐Ÿš€

For Your Career:

  • ๐Ÿ’ผ Docker skills increase salary by 20-30% for developers
  • ๐ŸŽฏ Essential requirement for modern DevOps and cloud roles
  • ๐ŸŒŸ Opens doors to microservices and cloud-native architecture
  • ๐Ÿค Makes you valuable for digital transformation projects

For Your Projects:

  • โšก Deploy applications 10x faster than traditional methods
  • ๐Ÿ›ก๏ธ Eliminate โ€œworks on my machineโ€ deployment issues
  • ๐Ÿ“ˆ Scale applications effortlessly based on demand
  • ๐Ÿ’ฐ Reduce infrastructure costs through efficient resource usage

For Your Team:

  • ๐Ÿš€ Enable consistent development environments for everyone
  • ๐Ÿ”„ Streamline CI/CD pipelines with containerized builds
  • ๐Ÿ˜Š Reduce deployment stress and emergency fixes
  • ๐ŸŽฏ Focus on features instead of environment configuration

Real-World Impact:

  • ๐Ÿข Netflix uses containers to serve 200+ million users
  • ๐Ÿ›’ E-commerce sites handle Black Friday traffic with containers
  • ๐Ÿฅ Healthcare systems ensure 99.9% uptime with containerization
  • ๐ŸŽฎ Gaming platforms scale instantly during viral moments

Youโ€™ve just learned the technology powering the modern internet! ๐Ÿ†

Remember, containerization isnโ€™t just about technology - itโ€™s about freedom. Freedom to deploy anywhere, scale instantly, and focus on what matters: building amazing applications that users love. You now have the superpower to package any application and run it consistently anywhere in the world! โญ

Happy containerizing! ๐Ÿ™Œ