Dockerd rootless: make {/etc,/var/run}/cdi available#48541
Dockerd rootless: make {/etc,/var/run}/cdi available#48541thaJeztah merged 1 commit intomoby:masterfrom
Conversation
b352067 to
52fb182
Compare
f2cfa80 to
02cd8d1
Compare
|
LGTM from a CDI perspective. |
02cd8d1 to
fa0824a
Compare
fa0824a to
ba8ed48
Compare
ba8ed48 to
f0338c1
Compare
|
We have already been applying this patch in production and it saves our day. Is there any possibility that we can merge this PR into the upcoming Docker release so no more patch is required for GPUs in Rootless Docker? |
f0338c1 to
d70cbc2
Compare
|
did a quick rebase to have a fresh run of CI |
d70cbc2 to
553b615
Compare
553b615 to
2f1100b
Compare
2f1100b to
2926e08
Compare
When dockerd is executed with the `dockerd-rootless.sh` script, make /etc/cdi and /var/run/cdi available to the daemon if they exist. This makes it possible to enable the CDI integration in rootless mode. Fixes: moby#47676 Signed-off-by: Rafael Fernández López <[email protected]>
2926e08 to
4e30acb
Compare
|
@ereslibre Can you create backports of this PR to 25.x through 27.x? I'm not sure if 25.x backport will actually help anyone, but a 27.x one would be sincerely appreciated. |
@stevapple Yes, I will do that later today! |
|
I was working on some backports, so opened cherry-picks for those branches 👍 |
Thanks @thaJeztah! |
| # mode; otherwise the Docker daemon won't have access to the CDI | ||
| # specification files. | ||
| mount_directory /etc/cdi | ||
| mount_directory /var/run/cdi |
There was a problem hiding this comment.
Is there any reason that we don't scan $XDG_CONFIG_HOME/cdi and XDG_RUNTIME_DIR/cdi ?
There was a problem hiding this comment.
No specific reason from my end
| # mode; otherwise the Docker daemon won't have access to the CDI | ||
| # specification files. | ||
| mount_directory /etc/cdi | ||
| mount_directory /var/run/cdi |
There was a problem hiding this comment.
These mounts are probably not necessary if we can let dockerd ignore EACCES ?
There was a problem hiding this comment.
They would not be necessary in that case. However, I wasn’t sure about the implications so I went with the safest approach.
When dockerd is executed with the
dockerd-rootless.shscript, make /etc/cdi and /var/run/cdi available to the daemon if they exist.This makes it possible to enable the CDI integration in rootless mode.
Fixes: #47676
Signed-off-by: Rafael Fernández López [email protected]
- What I did
When Dockerd is executed in rootless mode, the Container Device Interface won't be able to find the CDI specs at
/etc/cdinor/var/run/cdi.The implementation of the CDI code can be found at https://github.com/cncf-tags/container-device-interface. I am focusing on the latest tagged version (v0.8.0).
This implementation uses
filepath.Walk(https://pkg.go.dev/path/[email protected]#Walk), which documents not following symlinks.- How I did it
I modified the
contrib/dockerd-rootless.shscript so that the contents of/etc/cdiand/var/run/cdiare made available to the Dockerd daemon, which in turn uses the CDI code to load and interpret the CDI specs, allowing us to do something like the following:- How to verify it
Note that you will need a valid
/etc/cdior/var/run/cdidefinition of some hardware that follows the CDI specification, so that the Docker daemon can load it and make it available to you.You can use the following script if you have nix installed:
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)
A cute Vicuña. This is NixOS 24.11 release codename :)