I created an unit file, with the following lines to start-up a podman container. Unfortunately, right after starting up, journalctl -xe tells me service not needed, shutting down, service shuts down. podman ps --all says exited (0), hence, it is a regular stop.

Description=Service for auto-start the Podman NGINX Container


ExecStart=podman start nginx
ExecStop=podman stop nginx


I tried also some variants with StopWhenUnneeded=false, which made no difference.

System is RedHat8. The official RedHat-description to solve this didn't work.

1 Answer 1


There is a Podman command for creating a systemd service unit file

podman generate systemd --name --new nginx.

See the podman generate systemd man page.

Here is an example:

[root@asus ~]# podman create --name nginx -p 80:80 docker.io/library/nginx
[root@asus ~]# podman generate systemd --name --new nginx > /etc/systemd/system/nginx.service
[root@asus ~]# systemctl daemon-reload
[root@asus ~]# systemctl start nginx.service
[root@asus ~]# curl localhost:80
<!DOCTYPE html>
<title>Welcome to nginx!</title>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
[root@asus ~]# podman --version
podman version 3.4.4
[root@asus ~]# cat /etc/fedora-release 
Fedora release 35 (Thirty Five)
[root@asus ~]#
  • A colleague told me that finally (after I forgot about my question). But it's always usefull to have questions answered here => +1 Mar 21, 2022 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.