Biblioteca de cunoștințe

Installing Docker and Docker Compose Tipărire

  • docker, docker-compose, containers, devops
  • 0

Overview

Docker packages applications and their dependencies into containers, so they run the same way on any server. Docker Compose defines multi-container applications in a single YAML file. This article shows how to install Docker Engine and the Compose plugin on an ALYPOD CPU Pod and run your first stack.

Before you begin

  • A CPU Pod with a 64-bit OS (Debian/Ubuntu or RHEL family) and root/sudo access.
  • At least 1 GB RAM; 2 GB is more comfortable for real workloads.
  • Outbound internet access to pull images.

Steps

Install Docker Engine (official convenience script, or distro packages)

Debian / Ubuntu:

bash sudo apt update sudo apt install -y ca-certificates curl gnupg curl -fsSL https://get.docker.com | sudo sh

RHEL / AlmaLinux / Rocky:

bash sudo dnf install -y dnf-plugins-core sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

  1. Enable and start the daemon:

bash sudo systemctl enable --now docker sudo systemctl status docker

  1. (Optional) Run Docker as a non-root user:

bash sudo usermod -aG docker $USER newgrp docker

  1. Verify the install and Compose:

bash docker run --rm hello-world docker compose version

  1. Create a simple Compose stack. docker-compose.yml:

yaml services: web: image: nginx:alpine ports: - "8080:80" volumes: - ./html:/usr/share/nginx/html:ro restart: unless-stopped

  1. Start, inspect and stop it:

bash docker compose up -d docker compose ps docker compose logs -f web docker compose down

  1. Keep the host tidy over time:

bash docker system prune -a docker image prune

Troubleshooting

  • Problem: permission denied on the Docker socket. Solution: Add your user to the docker group and log out/in, or run with sudo.
  • Problem: Container cannot reach the network. Solution: Check that IP forwarding is enabled (sysctl net.ipv4.ip_forward) and the ALYPOD firewall allows outbound traffic.
  • Problem: Port already in use. Solution: Change the host port mapping or stop the conflicting service.

Related articles

  • [Installing the Nginx web server]
  • [Backing up your server with rsync]
  • [Installing PHP and common extensions]

Răspunsul a fost util?

« înapoi