I am starting and stopping container using systemd unit file service as.
Taking container name as hello
podman ps
shows hello
in output
- Auto generate unit file for hello
podman generate systemd --new --files --name hello
- The unit file contains
ExecStartPre=/bin/rm -f %t/%n.ctr-id
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --sdnotify=conmon --cgroups=no-conmon -d --hostname=first containerID
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
When I reboot system and check
systemctl status container-hello
I get status as
Active: running
But if I run
podman ps -a
, I get to seehello
asinactive
as well as another container added sayhello2
asrunning
.hello2
is associated with the unit file created in step 1 andhello
is not.
I have used --hostname as suggested but I cannot see container with that name when checked with podman ps pr podman ps -a