Manage podman with systemd

After getting the containers running you can have systemd start and stop them for you.

$ podman pull

$ podman run -dt -p 8080:80/tcp --name httpd

Now you can create systemd files:

$ cd $HOME/.config/systemd/user

$ podman generate systemd --new --files --name httpd

The podman generate command creates a systemd service file named container-httpd.service. Reload the daemon to read the new file:

$ systemctl --user daemon-reload

Stop the running container

$ podman stop httpd

Start the container with systemctl

$ systemctl --user start container-httpd.service

Check if it's active

$ systemctl --user is-active container-httpd.service


Stop the container with systemctl

$ systemctl --user stop container-httpd.service

Persist your user settings so the container doesn't stop when you logout (because all the temporary files for your login get deleted.)

$ loginctl enable-linger $LOGNAME

Set systemctl to start the container on reboot

$ systemctl --user enable container-httpd.service

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer