Contents

Set up Podman rootless containers to auto-start on Ubuntu 24.04 (Nginx Proxy Manager example)

🚀 Set up Podman rootless containers to auto-start on Ubuntu 24.04 (using Nginx Proxy Manager)

When running Podman containers on Ubuntu Server, you may hit these issues:

  • Containers do not auto-start on boot
  • systemctl --user error: Failed to connect to bus: No medium found
  • Rootless and root modes get mixed, making containers unmanageable
  • podman generate systemd cannot find the container
  • Containers disappear or fail to auto-restart after host reboot

This post summarizes how to correctly enable systemd auto-start for Podman rootless containers, based on a real incident.


🧩 Background: Podman rootless vs systemd

Podman differs from Docker:

FeatureDockerPodman
rootless supportPartialFull
Container storeRoot onlyRoot / user split
Auto-start--restartsystemd (recommended)

Podman officially recommends using systemd for auto-start, not Docker-style --restart=always.

But you must confirm:

  1. Which user owns the container (root / ubuntu)
  2. Whether user systemd is active
  3. Whether linger is enabled
  4. Whether a DBus user session exists

Otherwise you’ll see errors like:

Error: no such container
Failed to connect to bus: No medium found
Cannot manage rootless container as root

🧨 Issue 1: podman generate systemd cannot find the container

Running as root:

podman generate systemd --name nginx-proxy-manager

returns:

nginx-proxy-manager does not refer to a container

Reason:

👉 The container was created by user ubuntu (rootless), not by root. Root cannot see ubuntu’s containers—that’s by design.

Fix:

✔ Switch to ubuntu to generate systemd units:

sudo -iu ubuntu
podman generate systemd --name nginx-proxy-manager --files --new

🧨 Issue 2: systemctl --user errors with “No medium found”

Running:

systemctl --user daemon-reload

shows:

Failed to connect to bus: No medium found

Reason:

👉 You entered ubuntu via:

sudo -iu ubuntu

This does not start user systemd or a DBus session.


🧩 Fix: properly activate user systemd

1) Enable linger (allow user systemd to run in the background)

sudo loginctl enable-linger ubuntu

2) Start [email protected]

sudo systemctl start [email protected]

(1000 is the ubuntu UID)

3) Re-login as ubuntu via SSH (critical)

Log out all sessions and log back in:

ssh ubuntu@server

Now user systemd and DBus session will load automatically.

4) Verify systemctl works

systemctl --user daemon-reload

No error means it’s ready.


🧨 Issue 3: systemd service fails to start (rootless networking)

systemd previously reported:

unable to start container ... permission denied

Reason:

👉 Rootless containers must be managed by user systemd, not root systemd. Run systemctl in user mode.


🎯 Correct way to auto-start Podman containers (rootless)

Follow these steps 👇

① Switch to ubuntu

sudo -iu ubuntu

② Generate systemd service files

podman generate systemd --name nginx-proxy-manager --files --new

Output:

container-nginx-proxy-manager.service

③ Copy to user systemd directory

mkdir -p ~/.config/systemd/user
mv container-nginx-proxy-manager.service ~/.config/systemd/user/

④ Enable the user service

systemctl --user daemon-reload
systemctl --user enable container-nginx-proxy-manager
systemctl --user start container-nginx-proxy-manager

⑤ Check status

systemctl --user status container-nginx-proxy-manager

Expect:

Active: active (running)

⑥ Force user systemd to stay alive (avoid cold-boot failures)

sudo loginctl enable-linger ubuntu

🔥 Reboot test

sudo reboot

After reboot:

podman ps
systemctl --user status container-nginx-proxy-manager

The container should auto-start.


🏁 Final outcome

You get:

✔ A full Podman rootless auto-start setup

✔ Containers start with the system and auto-restart on crash

✔ User-level systemd bound to your containers

✔ No root needed to manage containers (safer)

✔ Works well for Nginx Proxy Manager, PostgreSQL, and more


📌 Common commands

ActionRootless systemd command
Startsystemctl --user start container-xxx
Stopsystemctl --user stop container-xxx
Restartsystemctl --user restart container-xxx
Logsjournalctl --user -u container-xxx -f
Listpodman ps

📚 Closing notes

With proper user systemd + Podman rootless setup, you can:

  • Run persistent services without root
  • Automate the entire container lifecycle
  • Avoid permission conflicts between Podman and systemd
  • Enjoy a safer model than Docker in some scenarios