Container not starting on boot

Hi everyone.

I try to start a container at boot time using systemd. It follows this guide
I have a container named “unifi”.

CONTAINER ID  IMAGE                   COMMAND           CREATED      STATUS                    PORTS                                                                                                                                             NAMES
0b3b250e03c4  localhost/unifi:6.0.41  /opt/unifi/unifi  12 days ago  Up 1 second ago >3478/udp,>5514/udp,>8080/tcp,>8443/tcp,>8843/tcp,>10001/udp  unifi

I did create a service file.

# /etc/systemd/system/unifi-container.service
Description=Unifi container

ExecStart=/usr/bin/podman start -a unifi
ExecStop=/usr/bin/podman stop -t 2 unifi


When I start the container manually with command systemctl start unfi-container it is working fine.
I enabled the service,

$ systemctl status unifi-container
● unifi-container.service - Unifi container
     Loaded: loaded (/etc/systemd/system/unifi-container.service; enabled; vendor preset: disabled)

but after a reboot the container is not started. There’s no error message in the logs and no sign systemd even tries to start the container.



I had similar issue to when I tried to start a docker with systemd, in the end I worked round it with a couple of bash scripts; one for start-up & one for stop and called these instead in the service file.

Alternatively there is a podman systemd generator:

Thanks Tom.


Is active? What does below command says?

systemctl status

Did you start your container with the --restart unless-stopped or --restart always flag? That would be correct way of ensuring the your container starts on boot and not using systemctl for the same as your service would first require the Podman socket service to start.

1 Like

Thanks Tom.

I may use a similar workaround, when I’m not able to go the systemd route.

I’ve tried podman generate, but that service file was also ignored.

Thanks ersen.

I’ve checked this and indeed was not active. I’ve replaced it with and Didn’t solve my issue though.

1 Like

Thanks Akashdeep.

I’ve used --restart always.

Your solution worked. The generated service used an active target. I just forgot to enable the new unit.


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.