Skip to content

Instantly share code, notes, and snippets.

@atomdmac
Last active August 6, 2023 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atomdmac/27152396fad95b7efa40517200c9da59 to your computer and use it in GitHub Desktop.
Save atomdmac/27152396fad95b7efa40517200c9da59 to your computer and use it in GitHub Desktop.
Using SystemD and podman-compose

How to Use Podman-Compose and SystemD

@blog @howto @linux

Go to the directory housing the podman-compose.yml file

cd my-podman-compose-project

Install podman-compose systemd service.

This allows user services to be started like this:

systemctl --user start 'podman-compose@my-podman-compose-project'

NOTE: If podman-compose isn't installed globally, you may need to do so in order to run this command as root.

sudo podman-compose systemd -a create-unit

Prepare container and group them into a pod

podman pod create --name pod_my_pod
podman-compose --in-pod pod_my_pod up --no-start
podman pod start pod_my_pod

Register The User-owned Service with Podman-Compose

This allows the project to be started using the podman-compose systemd service created at the beginning of this guide.

podman-compose systemd -a register

Start It Up

Now user-owned services can be started with systemctl, etc.

systemctl --user start 'podman-compose@my-podman-compose-project'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment