I’m building out a new server at home, and decided to try out Podman instead of Docker for running containers. Everything is a bit different. I wanted some containers to start on boot, as I had previously setup with Docker. I found an article that got me most of the way there, but it was missing a few key things for rootless containers. Here’s how I got a Vaultwarden container I setup, named vaultwarden, booting for user username and group groupname, on an Ubuntu / systemd based system.
Create a service file in /etc/systemd/system/vaultwarden.pod.service
[Unit]
Description=Vaultwarden/Bitwarden Server (Rust Edition)
Documentation=https://github.com/dani-garcia/vaultwarden
Wants=syslog.service
[Service]
Restart=on-failure
ExecStart=/usr/bin/podman start -a vaultwarden
ExecStop=/usr/bin/podman stop vaultwarden
User=username
Group=groupname
[Install]
WantedBy=multi-user.target
The following command allows the container to run when the user isn’t logged in (further details):
sudo loginctl enable-linger username
Reload the daemon:
sudo systemctl daemon-reload
And, your rootless Podman container should run at boot.