@@ -721,6 +721,12 @@ RUN --device=name,[required]
721
721
` RUN --device ` allows build to request [ CDI devices] ( https://github.com/moby/buildkit/blob/master/docs/cdi.md )
722
722
to be available to the build step.
723
723
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
+
724
730
The device ` name ` is provided by the CDI specification registered in BuildKit.
725
731
726
732
In the following example, multiple devices are registered in the CDI
@@ -752,6 +758,8 @@ devices:
752
758
containerEdits :
753
759
env :
754
760
- QUX=injected
761
+ annotations :
762
+ org.mobyproject.buildkit.device.autoallow : true
755
763
` ` `
756
764
757
765
The device name format is flexible and accepts various patterns to support
@@ -762,6 +770,14 @@ multiple device configurations:
762
770
* `vendor1.com/device=*`: request all devices for this vendor
763
771
* `class1`: request devices by `org.mobyproject.buildkit.device.class` annotation
764
772
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
+
765
781
# ### Example: CUDA-Powered LLaMA Inference
766
782
767
783
In this example we use the `--device` flag to run `llama.cpp` inference using
0 commit comments