LinuxCommandLibrary

podman-compose

Run multi-container applications using Compose files

TLDR

List all running containers

$ podman-compose ps
copy

Create and start all containers in the background using a local docker-compose.yml
$ podman-compose up [[-d|--detach]]
copy

Start all containers, building if needed
$ podman-compose up --build
copy

Start all containers using an alternate compose file
$ podman-compose [[-f|--file]] [path/to/file.yaml] up
copy

Stop all running containers
$ podman-compose stop
copy

Remove all containers, networks, and volumes
$ podman-compose down [[-v|--volumes]]
copy

Follow logs for a container (omit all container names)
$ podman-compose logs [[-f|--follow]] [container_name]
copy

Run a one-time command in a service with no ports mapped
$ podman-compose run [service_name] [command]
copy

SYNOPSIS

podman-compose [OPTIONS] [COMMAND] [ARGS...]

PARAMETERS

up
    Builds, (re)creates, starts, and attaches to containers for a service.

down
    Stops and removes containers, networks, volumes, and images created by up.

build [SERVICE...]
    Builds or rebuilds services.

start [SERVICE...]
    Starts existing containers for a service.

stop [SERVICE...]
    Stops running containers without removing them.

ps
    Lists containers for a service.

logs [SERVICE...]
    Fetches and displays logs from containers.

exec [SERVICE] [COMMAND]
    Executes a one-off command in a running container.

-f, --file FILE
    Specify an alternate compose file.

-p, --project-name NAME
    Specify an alternate project name (defaults to directory name).

-v, --version
    Show podman-compose version information and exit.

--podman-path PATH
    Specify the path to the podman executable.

--compatibility
    Enable compatibility mode for some Docker Compose features (e.g., tmpfs volumes).

DESCRIPTION

podman-compose is a Python script that provides a familiar Docker Compose-like experience for managing multi-container applications using Podman.

Its primary purpose is to allow users to leverage existing or create new docker-compose.yml (or compose.yaml) files to define and run services with Podman, a daemonless container engine. This tool helps bridge the gap for users transitioning from Docker to Podman, enabling them to reuse their compose configurations without significant modifications.

It interprets the YAML configuration, translating it into a series of Podman commands to build images, create containers, set up networks, and manage volumes, orchestrating the entire application stack. While it aims for high compatibility with Docker Compose, it's important to note that it is a community-driven project and may not support every advanced or niche feature found in Docker Compose. It serves as an invaluable utility for developing and deploying complex applications in a Podman environment, offering a streamlined workflow for defining and managing interconnected services.

CAVEATS

podman-compose is a community-developed project and not officially part of the Podman ecosystem. While it strives for compatibility with Docker Compose files, 100% feature parity is not guaranteed. Some advanced or newer features, particularly those related to networking specifics or complex volume configurations, might behave differently or not be fully supported. Users should test their Docker Compose files thoroughly when migrating to Podman via podman-compose.

COMPOSE FILE COMPATIBILITY

podman-compose directly uses standard docker-compose.yml or compose.yaml files. This means that if you have a project defined with Docker Compose, you can often run it with podman-compose with minimal or no changes, facilitating easy migration between container runtimes.

INSTALLATION

podman-compose is typically installed via Python's pip package manager, often as pip install podman-compose. It requires a working Podman installation on the system. As it is a Python script, it does not embed Podman functionality but rather calls the Podman command-line interface internally.

HISTORY

The genesis of podman-compose lies in the increasing adoption of Podman as an alternative to Docker, especially in environments favoring daemonless container management. Users with existing Docker Compose workflows needed a seamless transition path. As Podman itself does not include an integrated compose tool, the community stepped in to fill this void. Developed as a Python script, podman-compose began as an independent project, evolving to translate Compose file directives into equivalent Podman commands. Its development closely tracks updates in both the Podman and Docker Compose projects, aiming to maintain relevance and functionality amidst evolving container technologies.

SEE ALSO

Copied to clipboard