Skip to content
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

Support podman's "systemd" option when creating a container #408

Closed
LewisGaul opened this issue Jan 29, 2023 · 2 comments · Fixed by #453
Closed

Support podman's "systemd" option when creating a container #408

LewisGaul opened this issue Jan 29, 2023 · 2 comments · Fixed by #453
Labels
podman Specific to podman

Comments

@LewisGaul
Copy link
Collaborator

Podman supports a --systemd={true,false,always} option to podman run or podman create (docs). There is no expectation that Docker will implement this (Docker actively doesn't want to support running systemd in a container), so I'm not sure how you feel about adding this option?

Unfortunately there's a Podman bug where when it tries to run a container in systemd mode it fails on non-systemd hosts using cgroups v1. The default behaviour is --systemd=true, which really means 'detect', i.e. run in systemd mode if the container is detected to use systemd. This means that with podman v3 a workaround is required to be able to start a systemd container on such hosts (such as Alpine 3.15).

Possible workarounds:

  • Explicitly disable systemd mode (parity with Docker behaviour) with --systemd=false
  • Manually create the /sys/fs/cgroup/systemd/ mount on the host
  • Use latest podman, use cgroups v2, or use docker...

My preferred, normal solution is the first - fundamentally this is podman adding special handling but in a broken way, so I just want to disable that special handling... Podman is much easier to get going with on Alpine, and I'm specifically wanting to test on a cgroups v1 host.

I appreciate due to this only being requested to allow working around an issue in podman and with the option not being provided by docker it might not be a very appealing thing to add to the API. However, if not all arguments will be supported it would be nice if there was at least an escape hatch to pass arbitrary arguments through to the container client rather than getting something like "TypeError: run() got an unexpected keyword argument 'systemd'".

What do you think?

@gabrieldemarmiesse
Copy link
Owner

I am open to support options that are present in certain implementations of Docker and not others. Though I will limit it to

  • Docker
  • Podman
  • Nerdctl

Feel free to make a pull request, don't forget to document in the docstring that this option is only available in podman, and do not make a runtime check to disable the option in other clients than podman. I don't think it's possible to do a reliable runtime check because users can refer to aliases in client_call, so it's actually impossible to know. Also because this option might be supported later by some clients and might be supported by clients we have no knowledge about

@LewisGaul
Copy link
Collaborator Author

Ok fair enough, I'll hopefully get a chance to create a PR at some point, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
podman Specific to podman
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants