Podman is a fork of Docker that Redhat is using. I really liked docker-compose functionality; fortunately there is a podman-compose project which is more or less the same thing.
I now have a setup where each podman container is controlled by a systemd service, set to run on startup, with version controlled podman-compose files.
First, I installed podman-compose:
sudo 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
I then created podman-compose files (syntax identical to docker-compose) for each container. Here is one example (jackett.yml)
I then created a corresponding systemd unit file for each container:
# Compose up
ExecStart=/usr/local/bin/podman-compose -f /home/nicholas/podman/jackett.yml up
# Compose down, remove containers and volumes
ExecStop=/usr/local/bin/podman-compose -f /home/nicholas/podman/jackett.yml down -v
I then do a systemctl daemon-reload, and enable the service for startup:
sudo systemctl daemon-reload
sudo systemctl enable jackett
Why not create a single podman-compose file for all my services, instead of creating individual services for each container? I wanted to be able to clearly see log output for each container with journalctl -f -u <service name.> If you lump all your services in a single compose file, the output from each container gets all jumbled into that single service log. Separating out each container into its own service was more clean.