-
Notifications
You must be signed in to change notification settings - Fork 489
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
docs: bake v0.19 entitlements #2835
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ Build from a file | |
|
||
| Name | Type | Default | Description | | ||
|:------------------------------------|:--------------|:--------|:----------------------------------------------------------------------------------------------------| | ||
| `--allow` | `stringArray` | | Allow build to access specified resources | | ||
| [`--allow`](#allow) | `stringArray` | | Allow build to access specified resources | | ||
| [`--builder`](#builder) | `string` | | Override the configured builder instance | | ||
| [`--call`](#call) | `string` | `build` | Set method for evaluating build (`check`, `outline`, `targets`) | | ||
| [`--check`](#check) | `bool` | | Shorthand for `--call=check` | | ||
|
@@ -50,6 +50,66 @@ guide for introduction to writing bake files. | |
|
||
## Examples | ||
|
||
### <a name="allow"></a> Allow extra privileged entitelement (--allow) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be good to explain here a bit why allowing entitlements is needed and in what cases it protects the user. |
||
```text | ||
--allow=ENTITLEMENT[=VALUE] | ||
``` | ||
|
||
In addition to BuildKit's `network.host` and `security.insecure` entitlements | ||
(see [`docker buildx build --allow`](https://docs.docker.com/reference/cli/docker/buildx/build/#allow), | ||
Bake also supports the following entitlements: | ||
|
||
- `fs.read=<path|*>` - Grant read access to files outside of the working | ||
directory. | ||
- `fs.write=<path|*>` - Grant write access to files outside of the working | ||
directory. | ||
Comment on lines
+63
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is also |
||
|
||
The `fs.read` and `fs.write` entitlements take a path value (relative or | ||
absolute) to a directory on the filesystem. Alternatively, you can pass a | ||
wildcard (`*`) to allow Bake to access the entire filesystem. | ||
|
||
### Example: fs.read | ||
|
||
Given the following Bake configuration, Bake would need to access the parent | ||
directory, relative to the Bake file. | ||
|
||
```hcl | ||
target "app" { | ||
context = "../src" | ||
} | ||
``` | ||
|
||
Assuming `docker buildx bake app` is executed in the same directory as the | ||
`docker-bake.hcl` file, you would need to explicitly allow Bake to read from | ||
the `../src` directory. In this case, the following invocations all work: | ||
|
||
```console | ||
$ docker buildx bake --allow fs.read=* app | ||
$ docker buildx bake --allow fs.read=../ app | ||
$ docker buildx bake --allow fs.read=../src app | ||
``` | ||
|
||
### Example: fs.write | ||
|
||
The following `docker-bake.hcl` file requires write access to the `/tmp` | ||
directory. | ||
|
||
```hcl | ||
target "app" { | ||
output = "/tmp" | ||
} | ||
``` | ||
|
||
Assuming `docker buildx bake app` is executed outside of the `/tmp` directory, | ||
you would need to allow the `fs.write` entitlement, either by specifying the | ||
path or using a wildcard: | ||
|
||
```console | ||
$ docker buildx bake --allow fs.write=/tmp app | ||
$ docker buildx bake --allow fs.write=* app | ||
``` | ||
|
||
### <a name="builder"></a> Override the configured builder instance (--builder) | ||
|
||
Same as [`buildx --builder`](buildx.md#builder). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entitlement