podman/contrib/systemd
Andrew Sayers 527a51dcc4
Fix podman-restart.service when there are no containers
If no containers need to be restarted, podman-restart prints "Error: you must provide at least one name or id" then fails.

Update the service file to handle start and stop symmetrically.

See discussion in https://github.com/containers/podman/pull/25131

Signed-off-by: Andrew Sayers <andrew-github.com@pileofstuff.org>
2025-01-27 14:53:35 +00:00
..
system Fix podman-restart.service when there are no containers 2025-01-27 14:53:35 +00:00
user Fixes missing binary in systemd. 2024-11-28 23:42:44 +00:00
README.md Remove duplicated content in docs 2023-12-15 23:54:03 +01:00

README.md

Setting up Podman service for systemd socket activation

system-wide (podman service run as root)

  1. copy the podman.service and podman.socket files into /etc/systemd/system
  2. systemctl daemon-reload
  3. systemctl enable podman.socket
  4. systemctl start podman.socket
  5. systemctl status podman.socket podman.service

Assuming the status messages show no errors, the libpod service is ready to respond to the APIv2 on the unix domain socket /run/podman/podman.sock

podman.service

You can refer to this example for a sample podman.service file.

Note: replace @@PODMAN@@ with path to podman binary, such as /usr/bin/podman

podman.socket

You can refer to this example for a sample podman.socket file.

user (podman service run as given user aka "rootless")

  1. mkdir -p ~/.config/systemd/user
  2. copy the podman.service and podman.socket files into ~/.config/systemd/user
  3. systemctl --user enable podman.socket
  4. systemctl --user start podman.socket
  5. systemctl --user status podman.socket podman.service

Assuming the status messages show no errors, the libpod service is ready to respond to the APIv2 on the unix domain socket /run/user/$(id -u)/podman/podman.sock