-
Notifications
You must be signed in to change notification settings - Fork 53
Remove deb_family_systemd_volume from docker_exp #198
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
Conversation
The `deb_family_systemd_volume` logic hardcoded a `--volume /sys/fs/cgroup:/sys/fs/cgroup:ro` flag when provisioning Debian or Ubuntu containers in order to allow SystemD to run. However, this mount is no longer sufficient when the docker host is running a Kernel with CGroupsV2 and a SystemD version that defaults to using `systemd.enableUnifiedCgroupHierarchy=true`: docker/for-mac#6073 Ubuntu 22.04 fits these criteria. In these conditions, `--cgroupns=host -v /sys/fs/cgroup:/sys/fs/cgroup:rw` must be used. However, attempting to pass these flags to `docker_exp` via `docker_run_opts` causes `docker run` to fail due to a conflict with the hardcoded mount from `deb_family_systemd_volume`: ``` stderr:docker: Error response from daemon: Duplicate mount point: /sys/fs/cgroup. ``` This commit removes the `deb_family_systemd_volume` logic as: - CGroup mounts must be configured for any OS family using SystemD, not just Debian and Ubuntu. - The user should be able to exercise full control over mount flags via `docker_run_opts`.
4ddef81 to
b88830d
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #198 +/- ##
=======================================
Coverage ? 77.46%
=======================================
Files ? 2
Lines ? 142
Branches ? 0
=======================================
Hits ? 110
Misses ? 32
Partials ? 0 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
|
Hello! 👋 This pull request has been open for a while and has had no recent activity. We've labelled it with If you are waiting on a response from us we will try and address your comments on a future Community Day. Alternatively, if it is no longer relevant to you please close the PR with a comment. Please note that if a pull request receives no update for 7 after it has been labelled, it will be closed. We are always happy to re-open pull request if they have been closed in error. |
|
Is this necessary? Ran into the same issue using the docker provisioner with the docker daemon in a nested ubuntu 22 container: ---
default:
provisioner: docker
images:
- litmusimage/debian:11
vars: "docker_run_opts: ['--tmpfs=/run', '--tmpfs=/run/lock', '-v=/sys/fs/cgroup/puppet.slice:/sys/fs/cgroup/puppet.slice:rw', '--cgroupns=host', '--cgroup-parent=puppet.slice']" |
|
Did setting those vars in the config work for you? |
|
@chelnak Indeed. Adding a parent cgroup (which docker will auto-create) and mounting the parent as read-write ends up creating a docker-* specific cgroup underneath puppet.slice for each container without interfering with the hosts cgroup. |
|
@Sharpie Nice one! could you rebase off main & that should re-kick the CI too. |
|
Just after taking a further look into this, looks like there is still some references to deb_family_systemd_volume in provision/tasks/docker.rb Line 164 in b88830d
Feel free to lift the changes out of my fork from here :-) |
|
Closing in favour of #203 |
The
deb_family_systemd_volumelogic hardcoded a--volume /sys/fs/cgroup:/sys/fs/cgroup:roflag when provisioningDebian or Ubuntu containers in order to allow SystemD to run.
However, this mount is no longer sufficient when the docker host
is running a Kernel with CGroupsV2 and a SystemD version that defaults
to using
systemd.enableUnifiedCgroupHierarchy=true:docker/for-mac#6073
Ubuntu 22.04 fits these criteria.
In these conditions,
--cgroupns=host -v /sys/fs/cgroup:/sys/fs/cgroup:rwmust be used. However, attempting to pass these flags to
docker_expvia
docker_run_optscausesdocker runto fail due to a conflictwith the hardcoded mount from
deb_family_systemd_volume:This commit removes the
deb_family_systemd_volumelogic as:CGroup mounts must be configured for any OS family using SystemD, not
just Debian and Ubuntu.
The user should be able to exercise full control over mount flags
via
docker_run_opts.