-
-
Notifications
You must be signed in to change notification settings - Fork 2
Linux Docker Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to Docker on Linux, covering Arch Linux, CachyOS, and other distributions including installation, container management, and Docker Compose.
Arch/CachyOS:
# Install Docker
sudo pacman -S docker docker-compose
# Enable service
sudo systemctl enable --now docker
# Add user to docker group
sudo usermod -aG docker $USERDebian/Ubuntu:
sudo apt install docker.io docker-compose
sudo systemctl enable dockerFedora:
sudo dnf install docker docker-compose
sudo systemctl enable dockerCheck Docker:
# Check version
docker --version
# Test Docker
docker run hello-worldBasic usage:
# Run container
docker run nginx
# Run in background
docker run -d nginx
# Run with name
docker run --name my-nginx nginxManage containers:
# List containers
docker ps
docker ps -a
# Stop container
docker stop container-name
# Start container
docker start container-name
# Remove container
docker rm container-nameRun commands in container:
# Execute command
docker exec -it container-name /bin/bash
# Run command
docker exec container-name commandContainer logs:
# View logs
docker logs container-name
# Follow logs
docker logs -f container-nameDownload images:
# Pull image
docker pull nginx
# List images
docker images
# Remove image
docker rmi image-nameCreate image:
# Build from Dockerfile
docker build -t my-image .
# Tag image
docker tag my-image:latest my-image:v1.0Use Compose:
# Start services
docker-compose up -d
# Stop services
docker-compose down
# View logs
docker-compose logsdocker-compose.yml:
version: '3'
services:
web:
image: nginx
ports:
- "80:80"
db:
image: postgres
environment:
POSTGRES_PASSWORD: passwordCheck service:
# Check status
systemctl status docker
# Start Docker
sudo systemctl start docker
# Check logs
journalctl -u dockerFix permissions:
# Add user to docker group
sudo usermod -aG docker $USER
# Log out and back inThis guide covered Docker installation, container management, and Docker Compose for Arch Linux, CachyOS, and other distributions.
- Virtualization - Virtualization
- Container Orchestration - Orchestration
- Docker: https://www.docker.com/
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.