mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 13:37:08 +08:00
address review comments
Signed-off-by: David Karlsson <david.karlsson@docker.com>
This commit is contained in:
@ -17,7 +17,10 @@ Run the following command to create a new builder, named `container`, that uses
|
|||||||
the Docker container driver:
|
the Docker container driver:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker buildx create --name container --driver docker-container
|
$ docker buildx create \
|
||||||
|
--name container \
|
||||||
|
--driver=docker-container \
|
||||||
|
--driver-opt=[key=value,...]
|
||||||
container
|
container
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -26,13 +29,14 @@ pass to `--driver-opt`:
|
|||||||
|
|
||||||
| Parameter | Value | Default | Description |
|
| Parameter | Value | Default | Description |
|
||||||
| --------------- | ------ | ---------------- | ------------------------------------------------------------------------------------------ |
|
| --------------- | ------ | ---------------- | ------------------------------------------------------------------------------------------ |
|
||||||
| `image` | string | | Sets the image to use for running BuildKit. |
|
| `image` | String | | Sets the image to use for running BuildKit. |
|
||||||
| `network` | string | | Sets the network mode for running the BuildKit container. |
|
| `network` | String | | Sets the network mode for running the BuildKit container. |
|
||||||
| `cgroup-parent` | string | `/docker/buildx` | Sets the cgroup parent of the BuildKit container if Docker is using the `cgroupfs` driver. |
|
| `cgroup-parent` | String | `/docker/buildx` | Sets the cgroup parent of the BuildKit container if Docker is using the `cgroupfs` driver. |
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
When you run a build, Buildx pulls the specified `image` (by default, [`moby/buildkit`](https://hub.docker.com/r/moby/buildkit))
|
When you run a build, Buildx pulls the specified `image` (by default,
|
||||||
|
[`moby/buildkit`](https://hub.docker.com/r/moby/buildkit))
|
||||||
[Docker Hub](https://hub.docker.com/u/moby/buildkit). When the container has
|
[Docker Hub](https://hub.docker.com/u/moby/buildkit). When the container has
|
||||||
started, Buildx submits the build submitted to the containerized build server.
|
started, Buildx submits the build submitted to the containerized build server.
|
||||||
|
|
||||||
@ -99,6 +103,3 @@ $ docker buildx build . \
|
|||||||
|
|
||||||
For more information on the Docker container driver, see the
|
For more information on the Docker container driver, see the
|
||||||
[buildx reference](https://docs.docker.com/engine/reference/commandline/buildx_create/#driver).
|
[buildx reference](https://docs.docker.com/engine/reference/commandline/buildx_create/#driver).
|
||||||
|
|
||||||
If want to explore builders running on a remote server, see the
|
|
||||||
[Kubernetes driver](./kubernetes.md) and the [Remote driver](./remote.md).
|
|
||||||
|
@ -12,19 +12,17 @@ Buildx supports the following drivers:
|
|||||||
Different drivers support different use cases. The default `docker` driver
|
Different drivers support different use cases. The default `docker` driver
|
||||||
prioritizes simplicity and ease of use. It has limited support for advanced
|
prioritizes simplicity and ease of use. It has limited support for advanced
|
||||||
features like caching and output formats, and isn't configurable. Other drivers
|
features like caching and output formats, and isn't configurable. Other drivers
|
||||||
provide more flexibility and are better at handling advanced scenarios. The
|
provide more flexibility and are better at handling advanced scenarios.
|
||||||
`kubernetes` and `remote` drivers specifically aim to enable remote builders.
|
|
||||||
|
|
||||||
The following table outlines some of the differences between drivers.
|
The following table outlines some of the differences between drivers.
|
||||||
|
|
||||||
| Feature | `docker` | `docker-container` | `kubernetes` | `remote` |
|
| Feature | `docker` | `docker-container` | `kubernetes` | `remote` |
|
||||||
| :--------------------------- | :---------: | :----------------: | :----------: | :----------------: |
|
| :--------------------------- | :---------: | :----------------: | :----------: | :----------------: |
|
||||||
| **Automatically load image** | Yes | No | No | No |
|
| **Automatically load image** | ✅ | | | |
|
||||||
| **Cache export** | Inline only | Yes | Yes | Yes |
|
| **Cache export** | Inline only | ✅ | ✅ | ✅ |
|
||||||
| **Remote builders** | No | No | Yes | Yes |
|
| **Tarball output** | | ✅ | ✅ | ✅ |
|
||||||
| **Tarball output** | No | Yes | Yes | Yes |
|
| **Multi-arch images** | | ✅ | ✅ | ✅ |
|
||||||
| **Multi-arch images** | No | Yes | Yes | Yes |
|
| **BuildKit configuration** | | ✅ | ✅ | Managed externally |
|
||||||
| **BuildKit configuration** | No | Yes | Yes | Managed externally |
|
|
||||||
|
|
||||||
## List available builders
|
## List available builders
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ The following table describes the available driver-specific options that you can
|
|||||||
pass to `--driver-opt`:
|
pass to `--driver-opt`:
|
||||||
|
|
||||||
| Parameter | Value | Default | Description |
|
| Parameter | Value | Default | Description |
|
||||||
| ----------------- | ---------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
| ----------------- | ----------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
| `image` | String | | Sets the image to use for running BuildKit. |
|
| `image` | String | | Sets the image to use for running BuildKit. |
|
||||||
| `namespace` | String | Namespace in current Kubernetes context | Sets the Kubernetes namespace. |
|
| `namespace` | String | Namespace in current Kubernetes context | Sets the Kubernetes namespace. |
|
||||||
| `replicas` | Integer | 1 | Sets the number of Pod replicas to create. See [scaling BuildKit][1] |
|
| `replicas` | Integer | 1 | Sets the number of Pod replicas to create. See [scaling BuildKit][1] |
|
||||||
@ -31,9 +31,9 @@ pass to `--driver-opt`:
|
|||||||
| `limits.memory` | Memory size | | Sets the limit memory value specified in bytes or with a valid suffix. For example `requests.memory=500Mi` or `requests.memory=4G` |
|
| `limits.memory` | Memory size | | Sets the limit memory value specified in bytes or with a valid suffix. For example `requests.memory=500Mi` or `requests.memory=4G` |
|
||||||
| `nodeselector` | CSV string | | Sets the pod's `nodeSelector` label(s). See [node assignment][2]. |
|
| `nodeselector` | CSV string | | Sets the pod's `nodeSelector` label(s). See [node assignment][2]. |
|
||||||
| `tolerations` | CSV string | | Configures the pod's taint toleration. See [node assignment][2]. |
|
| `tolerations` | CSV string | | Configures the pod's taint toleration. See [node assignment][2]. |
|
||||||
| `rootless` | `true\|false` | `false` | Run the container as a non-root user. See [rootless mode][3]. |
|
| `rootless` | `true`,`false` | `false` | Run the container as a non-root user. See [rootless mode][3]. |
|
||||||
| `loadbalance` | `sticky\|random` | `sticky` | Load-balancing strategy. If set to `sticky`, the pod is chosen using the hash of the context path. |
|
| `loadbalance` | `sticky`,`random` | `sticky` | Load-balancing strategy. If set to `sticky`, the pod is chosen using the hash of the context path. |
|
||||||
| `qemu.install` | `true\|false` | | Install QEMU emulation for multi platforms support. See [QEMU][4]. |
|
| `qemu.install` | `true`,`false` | | Install QEMU emulation for multi platforms support. See [QEMU][4]. |
|
||||||
| `qemu.image` | String | `tonistiigi/binfmt:latest` | Sets the QEMU emulation image. See [QEMU][4]. |
|
| `qemu.image` | String | `tonistiigi/binfmt:latest` | Sets the QEMU emulation image. See [QEMU][4]. |
|
||||||
|
|
||||||
[1]: #scaling-buildkit
|
[1]: #scaling-buildkit
|
||||||
@ -107,16 +107,16 @@ the same values as the Kubernetes manifest. Each `tolerations` entry specifies a
|
|||||||
taint key and the value, operator, or effect. For example:
|
taint key and the value, operator, or effect. For example:
|
||||||
`"tolerations=key=foo,value=bar;key=foo2,operator=exists;key=foo3,effect=NoSchedule"`
|
`"tolerations=key=foo,value=bar;key=foo2,operator=exists;key=foo3,effect=NoSchedule"`
|
||||||
|
|
||||||
The syntax for these parameters is slightly different compared to other driver
|
Due to quoting rules for shell commands, you must wrap the `nodeselector` and
|
||||||
options. You must wrap both `nodeSelector` and `tolerations` in double quotes.
|
`tolerations` parameters in single quotes. You can even wrap all of
|
||||||
For example:
|
`--driver-opt` in single quotes, for example:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker buildx create \
|
$ docker buildx create \
|
||||||
--bootstrap \
|
--bootstrap \
|
||||||
--name=kube \
|
--name=kube \
|
||||||
--driver=kubernetes \
|
--driver=kubernetes \
|
||||||
--driver-opt="nodeselector=label=value","tolerations=key=key1,value=value1"
|
'--driver-opt="nodeselector=label1=value1,label2=value2","tolerations=key=key1,value=value1"'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Multi-platform builds
|
## Multi-platform builds
|
||||||
@ -238,7 +238,7 @@ This will create your pods without `securityContext.privileged`.
|
|||||||
Requires Kubernetes version 1.19 or later. Using Ubuntu as the host kernel is
|
Requires Kubernetes version 1.19 or later. Using Ubuntu as the host kernel is
|
||||||
recommended.
|
recommended.
|
||||||
|
|
||||||
## Guide: Creating a Buildx builder in Kubernetes
|
## Example: Creating a Buildx builder in Kubernetes
|
||||||
|
|
||||||
This guide shows you how to:
|
This guide shows you how to:
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ pass to `--driver-opt`:
|
|||||||
| `cacert` | String | | Sets the TLS certificate authority used for validation. |
|
| `cacert` | String | | Sets the TLS certificate authority used for validation. |
|
||||||
| `servername` | String | Endpoint hostname. | Sets the TLS server name used in requests. |
|
| `servername` | String | Endpoint hostname. | Sets the TLS server name used in requests. |
|
||||||
|
|
||||||
## Guide: Remote BuildKit over Unix sockets
|
## Example: Remote BuildKit over Unix sockets
|
||||||
|
|
||||||
This guide shows you how to create a setup with a BuildKit daemon listening on a
|
This guide shows you how to create a setup with a BuildKit daemon listening on a
|
||||||
Unix socket, and have Buildx connect through it.
|
Unix socket, and have Buildx connect through it.
|
||||||
@ -81,7 +81,7 @@ $ docker buildx build . --builder=remote-unix -t test --load
|
|||||||
Remember that you need to use the `--load` flag if you want to load the build
|
Remember that you need to use the `--load` flag if you want to load the build
|
||||||
result into the Docker daemon.
|
result into the Docker daemon.
|
||||||
|
|
||||||
## Guide: Remote BuildKit in Docker container
|
## Example: Remote BuildKit in Docker container
|
||||||
|
|
||||||
This guide will show you how to create setup similar to the `docker-container`
|
This guide will show you how to create setup similar to the `docker-container`
|
||||||
driver, by manually booting a BuildKit Docker container and connecting to it
|
driver, by manually booting a BuildKit Docker container and connecting to it
|
||||||
@ -136,7 +136,7 @@ but this is for illustration purposes.)
|
|||||||
docker-container://remote-container
|
docker-container://remote-container
|
||||||
```
|
```
|
||||||
|
|
||||||
## Guide: Remote BuildKit in Kubernetes
|
## Example: Remote BuildKit in Kubernetes
|
||||||
|
|
||||||
This guide will show you how to create a setup similar to the `kubernetes`
|
This guide will show you how to create a setup similar to the `kubernetes`
|
||||||
driver by manually creating a BuildKit `Deployment`. While the `kubernetes`
|
driver by manually creating a BuildKit `Deployment`. While the `kubernetes`
|
||||||
|
Reference in New Issue
Block a user