Skip to content

Commit 5dae5a0

Browse files
committed
docs: cdi autoallow and device entitlement
Signed-off-by: CrazyMax <[email protected]>
1 parent 0506df9 commit 5dae5a0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

frontend/dockerfile/docs/reference.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,12 @@ RUN --device=name,[required]
721721
`RUN --device` allows build to request [CDI devices](https://github.com/moby/buildkit/blob/master/docs/cdi.md)
722722
to be available to the build step.
723723

724+
> [!WARNING]
725+
> The use of `--device` is protected by the `device` entitlement, which needs
726+
> to be enabled when starting the buildkitd daemon with
727+
> `--allow-insecure-entitlement device` flag or in [buildkitd config](https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md),
728+
> and for a build request with [`--allow device` flag](https://docs.docker.com/engine/reference/commandline/buildx_build/#allow).
729+
724730
The device `name` is provided by the CDI specification registered in BuildKit.
725731

726732
In the following example, multiple devices are registered in the CDI
@@ -752,6 +758,8 @@ devices:
752758
containerEdits:
753759
env:
754760
- QUX=injected
761+
annotations:
762+
org.mobyproject.buildkit.device.autoallow: true
755763
```
756764
757765
The device name format is flexible and accepts various patterns to support
@@ -762,6 +770,14 @@ multiple device configurations:
762770
* `vendor1.com/device=*`: request all devices for this vendor
763771
* `class1`: request devices by `org.mobyproject.buildkit.device.class` annotation
764772

773+
> [!NOTE]
774+
> Annotations are supported by the CDI specification since 0.6.0.
775+
776+
> [!NOTE]
777+
> To automatically allow all devices registered in the CDI specification, you
778+
> can set the `org.mobyproject.buildkit.device.autoallow` annotation. You can
779+
> also set this annotation for a specific device.
780+
765781
#### Example: CUDA-Powered LLaMA Inference
766782

767783
In this example we use the `--device` flag to run `llama.cpp` inference using

0 commit comments

Comments
 (0)