From f5a3e25aceacfcbb1db530154aac0d00a23a276b Mon Sep 17 00:00:00 2001 From: rwxd Date: Thu, 15 Jun 2023 18:32:51 +0200 Subject: [PATCH] fix(podman): added podman-compose systemd files --- .../Podman/podman-compose-systemd-files.md | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 DevOps/Infrastructure-Solutions/Container/Podman/podman-compose-systemd-files.md diff --git a/DevOps/Infrastructure-Solutions/Container/Podman/podman-compose-systemd-files.md b/DevOps/Infrastructure-Solutions/Container/Podman/podman-compose-systemd-files.md new file mode 100644 index 00000000..f637a694 --- /dev/null +++ b/DevOps/Infrastructure-Solutions/Container/Podman/podman-compose-systemd-files.md @@ -0,0 +1,53 @@ +# Use systemd files with rootless podman-compose + +As of 06/15/2023 podman-compose must be manually installed to use version 1.0.7 (check with podman-compose -v), [because of not using pods as default](https://github.com/containers/podman-compose/issues/307#issuecomment-1517822926). + +```bash +pip3 install git+https://github.com/containers/podman-compose.git +``` + +## Setup + +Add the rootless podman user to the systemd-journal group to watch logs. + +```bash +usermod -aG systemd-journal podman +``` + +Create the systemd podman-compose unit with root permissions + +```bash +sudo podman-compose systemd --action create-unit +sudo systemctl daemon-reload +``` + +Change to the directory where your podman-compose file resides. + +Register the project + +```bash +podman-compose systemd --action register + +# or with a different file name than podman-compose.yaml +podman-compose -f docker-compose.yaml systemd --action register +``` + +Enable and start the systemd service + +```bash +systemctl --user enable --now 'podman-compose@project-name' +``` + +## Troubleshooting + +When the systemd unit is create you can use + +```bash +podman pod ls + +podman pod inspect pod_project-name + +systemctl --user status -l podman-compose@project-name + +journalctl --user -xu podman-compose@project-name +```