[Container - Podman] Podman Compose - An implementation of Compose Spec with Podman backend

Podman Compose

Podman Compose is an implementation of Compose Spec with Podman backend. This project focus on:

  • Rootless

  • Daemonless process model, we directly execute podman, no running daemon.

This project only depend on:

  • podman

  • podman dnsname plugin (Optional requirement. If necessary, the containers be able to resolve each other if they are on the same CNI network. In distributions, it is usually found in the podman-plugins or podman-dnsname package)

  • Python3

  • PyYAML

  • python-dotenv

Installation

Install latest stable version from PyPI:

1
2
3
4
$ pip3 install podman-compose

# Not root user.
# $ pip3 install podman-compose --user

pass --user to install inside regular user home without being root.

Or latest development version from GitHub:

1
$ pip3 install https://github.com/containers/podman-compose/archive/devel.tar.gz

or

1
2
3
$ curl -o /usr/local/bin/podman-compose https://raw.githubusercontent.com/containers/podman-compose/devel/podman_compose.py

$ chmod +x /usr/local/bin/podman-compose

or inside your home

1
2
3
curl -o ~/.local/bin/podman-compose https://raw.githubusercontent.com/containers/podman-compose/devel/podman_compose.py

$ chmod +x ~/.local/bin/podman-compose

or install from Fedora (starting from f31) repositories:

1
$ sudo dnf install podman-compose

Basic Usage

We have included fully functional sample stacks inside examples/ - https://github.com/containers/podman-compose/tree/devel/examples directory.

A quick example would be

1
2
3
4
5
6
7
$ cd examples/busybox

$ podman-compose --help

$ podman-compose up --help

$ podman-compose up

A more rich example can be found in examples/awx3 - https://github.com/containers/podman-compose/tree/devel/examples/awx3 which have

  • A Postgres Database

  • RabbitMQ server

  • MemCached server

  • a django web server

  • a django tasks

When testing the AWX3 example, if you got errors just wait for db migrations to end. There is also AWX 17.1.0

FAQs

podman-compose ModuleNotFoundError: No module named ‘dotenv’

1
2
3
4
5
$ podman-compose
Traceback (most recent call last):
File "/usr/local/bin/podman-compose", line 34, in <module>
from dotenv import dotenv_values
ModuleNotFoundError: No module named 'dotenv'

Remember to install python-dotenv module.

1
$ pip3 install python-dotenv 

See import - no module named ‘dotenv’ python 3.8 - Stack Overflow - https://stackoverflow.com/questions/59572174/no-module-named-dotenv-python-3-8 to learn more.

Error: unrecognized command `podman network exists

podman 1.6.4 not support podman network exist command.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ podman -v
podman version 1.6.4

$ podman network --help
Manage networks

Usage:
podman network [command]

Available Commands:
create network create
inspect network inspect
ls network list
rm network rm

podmon 3.3.1+

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ podman -v
podman version 3.3.1

$ podman network --help
Manage networks

Description:
Manage networks

Usage:
podman network [command]

Available Commands:
connect network connect
create network create
disconnect network rm
exists network exists
inspect network inspect
ls network list
prune network prune
reload Reload firewall rules for one or more containers
rm network rm

References

[1] containers/podman-compose: a script to run docker-compose.yml using podman - https://github.com/containers/podman-compose

[2] Overview of Docker Compose | Docker Documentation - https://docs.docker.com/compose/

[3] Podman - https://podman.io/