-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
systemd generator: force run container detached if CreateCommand has no detach param #5439
systemd generator: force run container detached if CreateCommand has no detach param #5439
Conversation
48ba61f
to
8c4bc85
Compare
/assign @mheon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
Unit tests are not happy (see go test -v github.com/containers/libpod/pkg/systemd/generate
). Also please add a test to test/e2e/generate_systemd_test.go
where we create a container without -d
, then generate the output and look for --cgroups=no-conmon -d
in the output.
Adding a sentence or two to docs/source/markdown/podman-generate-systemd.1.md
would be great to explain why we enforce detaching.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please explain the changes in the commit message.
Thanks @ttys3 Interesting change. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mheon, ttys3 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
LGTM once comments from @vrothberg are addressed |
8c4bc85
to
a5513ec
Compare
a5513ec
to
91f08f1
Compare
be887a1
to
75a6adc
Compare
e2e tests are not yet happy:
|
…etach param the podman generated systemd service file has `Type=forking` service, so the command after `ExecStart=` should not run in front. if someone created a container and has the detach(`-d`) param missing like this ``` podman create --name ngxdemo -P nginxdemos/hello ``` and generate the file with `--new` param: ``` podman generate systemd --name --new ngxdemo ``` because `podman run xxx` has no `-d` param, so the container is not run in background and nerver exit. and systemd will fail to start the service: ``` sudo systemctl start container-ngxdemo.service Job for container-ngxdemo.service failed because a timeout was exceeded. See "systemctl status container-ngxdemo.service" and "journalctl -xe" for details. ``` Signed-off-by: 荒野無燈 <[email protected]>
75a6adc
to
194723f
Compare
fixed. special_testing_rootless name:remote Failing after 21m — Task Summary |
F30 remote is a known flake. Rootless might be a real but. Restarted to see if it was a flake, but wouldn't be surprised if it reoccurs. |
Another restart :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
This has broken CI. Is anyone working on a fix? |
PR collision with containers#5427 Solution: add 'default.target' to WantedBy Signed-off-by: Ed Santiago <[email protected]>
Entirely my bad as we should have rebased this PR before merging. #5514 is fixing CI. |
since we use systemd service
Type=forking
when we generated systemd service file using the
--new
param likewe got
ExecStart=/usr/bin/podman run --conmon-pidfile ...
if somehow the container's
CreateCommand
has no-d
or--detach
param,podman will run the container in default attached mode.
so systemd will wait the podman command exit until failed with timeout error.
quick reproduce the problem:
how to avoid the problem:
solution 1: merge this PR -_- and everything goes fine
solution 2: warn user to remember add
-d
when create the containerand user need to do is just add the
-d
param to thecreate
command: