Difference between --restart=always Vs having .service file restart container with Podman?
by JockVSJock from LinuxQuestions.org on (#5QF6C)
Just wondering if anyone has any insight having the --restart-always command when launching a container from an image Vs creating a .service file to restart a container, say if server is rebooted?
Are there any pros or cons with either or?
Here is an example of the --restart=always command
Code:[matt@localhost ~]$ podman run -d --name registry -p 5000:5000 -v "$(pwd)"/certs:/certs --restart=always -e REGISTRY_HTTP_ADDR=0.0.0.0:5000 -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key --privileged registry:2Reference from this blog:
https://snyk.io/blog/privileged-docker-containers/
Vs.
Using .service file to restart a container:
https://www.tutorialworks.com/podman-systemd/
Are there any pros or cons with either or?
Here is an example of the --restart=always command
Code:[matt@localhost ~]$ podman run -d --name registry -p 5000:5000 -v "$(pwd)"/certs:/certs --restart=always -e REGISTRY_HTTP_ADDR=0.0.0.0:5000 -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key --privileged registry:2Reference from this blog:
https://snyk.io/blog/privileged-docker-containers/
Vs.
Using .service file to restart a container:
https://www.tutorialworks.com/podman-systemd/