Skip to main content

CentOS Stream 10: Use Docker Compose

Install Docker Compose and use it with Podman to define and run multi-container applications.

May 25, 2026 5 min read
centoscentos-stream-10podmandockerdocker-composecontainers

Use Docker Compose with Podman to define and run multi-container applications.

Prerequisites

Install the podman-docker package first (see the previous guide).

Install Docker Compose

curl -L https://github.com/docker/compose/releases/download/v2.32.4/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
chmod 755 /usr/local/bin/docker-compose
docker-compose --version

Define a Multi-Container Application

Start the Podman socket:

systemctl start podman.socket

Create a Dockerfile for the web service:

FROM quay.io/centos/centos:stream10
LABEL Maintainer "ServerWorld <admin@srv.world>"

RUN dnf -y install nginx

EXPOSE 80
CMD ["/usr/sbin/nginx", "-g", "daemon off;"]

Create a docker-compose.yml with web and database services:

services:
  db:
    image: docker.io/library/mariadb
    volumes:
      - /var/lib/containers/disk01:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_USER: cent
      MYSQL_PASSWORD: password
      MYSQL_DATABASE: cent_db
    user: 0:0
    privileged: true
    ports:
      - "3306:3306"
  web:
    build: .
    ports:
      - "80:80"
    volumes:
      - /var/lib/containers/disk02:/usr/share/nginx/html
    privileged: true

Build and Start

docker-compose up -d

Verify the containers:

podman ps

Verify Access

Test the database connection:

mysql -h 127.0.0.1 -u root -p -e "show variables like 'hostname';"
mysql -h 127.0.0.1 -u cent -p -e "show databases;"

Test the web service:

echo "Hello Docker Compose World" > /var/lib/containers/disk02/index.html
curl 127.0.0.1

Basic Management

Check container status:

docker-compose ps

View logs:

docker-compose logs

Execute commands inside a container:

docker-compose exec db /bin/bash

Stop all services:

docker-compose stop

Remove containers:

docker-compose rm