@@ -15,7 +15,7 @@ Build from a file
1515
1616| Name | Type | Default | Description |
1717| :------------------------------------| :--------------| :--------| :-------------------------------------------------------------------------------------------------------------|
18- | ` --allow ` | ` stringArray ` | | Allow build to access specified resources |
18+ | [ ` --allow ` ] ( #allow ) | ` stringArray ` | | Allow build to access specified resources |
1919| [ ` --builder ` ] ( #builder ) | ` string ` | | Override the configured builder instance |
2020| [ ` --call ` ] ( #call ) | ` string ` | ` build ` | Set method for evaluating build (` check ` , ` outline ` , ` targets ` ) |
2121| [ ` --check ` ] ( #check ) | ` bool ` | | Shorthand for ` --call=check ` |
@@ -51,6 +51,80 @@ guide for introduction to writing bake files.
5151
5252## Examples
5353
54+ ### <a name =" allow " ></a > Allow extra privileged entitlement (--allow)
55+
56+ ``` text
57+ --allow=ENTITLEMENT[=VALUE]
58+ ```
59+
60+ Entitlements are designed to provide controlled access to privileged
61+ operations. By default, Buildx and BuildKit operates with restricted
62+ permissions to protect users and their systems from unintended side effects or
63+ security risks. The ` --allow ` flag explicitly grants access to additional
64+ entitlements, making it clear when a build or bake operation requires elevated
65+ privileges.
66+
67+ In addition to BuildKit's ` network.host ` and ` security.insecure ` entitlements
68+ (see [ ` docker buildx build --allow ` ] ( https://docs.docker.com/reference/cli/docker/buildx/build/#allow ) ,
69+ Bake supports file system entitlements that grant granular control over file
70+ system access. These are particularly useful when working with builds that need
71+ access to files outside the default working directory.
72+
73+ Bake supports the following filesystem entitlements:
74+
75+ - ` --allow fs=<path|*> ` - Grant read and write access to files outside of the
76+ working directory.
77+ - ` --allow fs.read=<path|*> ` - Grant read access to files outside of the
78+ working directory.
79+ - ` --allow fs.write=<path|*> ` - Grant write access to files outside of the
80+ working directory.
81+
82+ The ` fs ` entitlements take a path value (relative or absolute) to a directory
83+ on the filesystem. Alternatively, you can pass a wildcard (` * ` ) to allow Bake
84+ to access the entire filesystem.
85+
86+ ### Example: fs.read
87+
88+ Given the following Bake configuration, Bake would need to access the parent
89+ directory, relative to the Bake file.
90+
91+ ``` hcl
92+ target "app" {
93+ context = "../src"
94+ }
95+ ```
96+
97+ Assuming ` docker buildx bake app ` is executed in the same directory as the
98+ ` docker-bake.hcl ` file, you would need to explicitly allow Bake to read from
99+ the ` ../src ` directory. In this case, the following invocations all work:
100+
101+ ``` console
102+ $ docker buildx bake --allow fs.read=* app
103+ $ docker buildx bake --allow fs.read=../src app
104+ $ docker buildx bake --allow fs=* app
105+ ```
106+
107+ ### Example: fs.write
108+
109+ The following ` docker-bake.hcl ` file requires write access to the ` /tmp `
110+ directory.
111+
112+ ``` hcl
113+ target "app" {
114+ output = "/tmp"
115+ }
116+ ```
117+
118+ Assuming ` docker buildx bake app ` is executed outside of the ` /tmp ` directory,
119+ you would need to allow the ` fs.write ` entitlement, either by specifying the
120+ path or using a wildcard:
121+
122+ ``` console
123+ $ docker buildx bake --allow fs=/tmp app
124+ $ docker buildx bake --allow fs.write=/tmp app
125+ $ docker buildx bake --allow fs.write=* app
126+ ```
127+
54128### <a name =" builder " ></a > Override the configured builder instance (--builder)
55129
56130Same as [ ` buildx --builder ` ] ( buildx.md#builder ) .
0 commit comments