Reputation: 119
Is there a possibility to change container restart policy using podman? We can set policy during creating container podman run --restart always
, but how to change it when the container is created?
Using docker we have docker update
command which allows us to do so. Unfortunately there is no podman update
command. Can it be done? Or do I need to create a new container?
Upvotes: 9
Views: 9275
Reputation: 3013
podman update --restart=always <container-id>
available in podman update
since v 5.1.0
Upvotes: 0
Reputation: 155
when using podman you should create a systemd service that will manage podman container.
[Unit] Description=your container [Service] Restart=always ExecStart=/usr/bin/podman start -a containername ExecStop=/usr/bin/podman stop -t 2 containername [Install] WantedBy=local.target
systemctl daemon-reload
systemctl enable containername.service
systemctl restart containername.service
You can also add some other restart systemd parameters like:
RestartSec (Configures the time to sleep before restarting a service), StartLimitInterval (seconds service is it not permitted to start any more), StartLimitBurst
for more details check man pages: "man systemd.service"
Upvotes: 3