Closed arajczy closed 3 years ago
@vrothberg PTAL, we'll probably need to catch this in generate systemd
.
I think we can remap the container restart policy to a systemd restart policy and remove the --restart
from the podman run command.
I think we can remap the container restart policy to a systemd restart policy and remove the
--restart
from the podman run command.
I concur :+1:
Just stumbled into this and wonder why the error even happens? Should not it be valid to use --rm
and --restart-policy
together?
In https://github.com/containers/podman/issues/7906 this was once raised and apparently allowed/fixed in https://github.com/containers/podman/pull/8263?
Nevertheless, I agree that mapping the podman restart-policy to a systemd restart policy is a good thing to do.
And AFAIK it also used to work before 3.3.0 with both arguments combined or so, but I'm not sure.
I.e. with --restart unless-stopped
and --rm
.
$ podman version
Version: 3.3.0
API Version: 3.3.0
Go Version: go1.16.6
Built: Fri Aug 20 21:36:14 2021
OS/Arch: linux/amd64
Also you need to make sure your fix does not break the healthcheck feature – that podman still restarts on a failed healthcheck.
--rm
is only allowed with on-failure
as a restart policy.
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
bug
Description
Error in the value of ExecStart of
podman generate systemd
.podman run args --rm and --restart=always mutually exclusive. It prevents starting container as a service as it gives the below error:
podman[…]: Error: the --rm option conflicts with --restart, when the restartPolicy is not "" and "no"
Steps to reproduce the issue:
podman run -d \ --restart=always \ --tz=Europe/Budapest \ -p 27017:27017 \ -v mongoconfig:/data/configdb \ -v mongodata:/data/db \ -v mongodump:/dump \ --name=mongo \ docker.io/library/mongo:4 --auth
podman generate systemd --files --new --name mongo
podman rm -f mongo
systemctl enable --now container-mongo.service
Describe the results you received:
podman[6745]: Error: the --rm option conflicts with --restart, when the restartPolicy is not "" and "no"
Describe the results you expected:
enable and start container as a service
Additional information you deem important (e.g. issue happens only occasionally):
I have removed the arg
--rm
from the ExecStart in the service file and I could start the service successfully.Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.): physical