github.com/pdmccormick/importable-docker-buildx@v0.0.0-20240426161518-e47091289030/docs/reference/buildx_create.md (about) 1 # buildx create 2 3 ```text 4 docker buildx create [OPTIONS] [CONTEXT|ENDPOINT] 5 ``` 6 7 <!---MARKER_GEN_START--> 8 Create a new builder instance 9 10 ### Options 11 12 | Name | Type | Default | Description | 13 |:------------------------------------------|:--------------|:--------|:----------------------------------------------------------------------| 14 | [`--append`](#append) | | | Append a node to builder instead of changing it | 15 | `--bootstrap` | | | Boot builder after creation | 16 | [`--buildkitd-config`](#buildkitd-config) | `string` | | BuildKit daemon config file | 17 | [`--buildkitd-flags`](#buildkitd-flags) | `string` | | BuildKit daemon flags | 18 | [`--driver`](#driver) | `string` | | Driver to use (available: `docker-container`, `kubernetes`, `remote`) | 19 | [`--driver-opt`](#driver-opt) | `stringArray` | | Options for the driver | 20 | [`--leave`](#leave) | | | Remove a node from builder instead of changing it | 21 | [`--name`](#name) | `string` | | Builder instance name | 22 | [`--node`](#node) | `string` | | Create/modify node with given name | 23 | [`--platform`](#platform) | `stringArray` | | Fixed platforms for current node | 24 | [`--use`](#use) | | | Set the current builder instance | 25 26 27 <!---MARKER_GEN_END--> 28 29 30 ## Description 31 32 Create makes a new builder instance pointing to a Docker context or endpoint, 33 where context is the name of a context from `docker context ls` and endpoint is 34 the address for Docker socket (eg. `DOCKER_HOST` value). 35 36 By default, the current Docker configuration is used for determining the 37 context/endpoint value. 38 39 Builder instances are isolated environments where builds can be invoked. All 40 Docker contexts also get the default builder instance. 41 42 ## Examples 43 44 ### <a name="append"></a> Append a new node to an existing builder (--append) 45 46 The `--append` flag changes the action of the command to append a new node to an 47 existing builder specified by `--name`. Buildx will choose an appropriate node 48 for a build based on the platforms it supports. 49 50 ```console 51 $ docker buildx create mycontext1 52 eager_beaver 53 54 $ docker buildx create --name eager_beaver --append mycontext2 55 eager_beaver 56 ``` 57 58 ### <a name="buildkitd-config"></a> Specify a configuration file for the BuildKit daemon (--buildkitd-config) 59 60 ```text 61 --buildkitd-config FILE 62 ``` 63 64 Specifies the configuration file for the BuildKit daemon to use. The 65 configuration can be overridden by [`--buildkitd-flags`](#buildkitd-flags). 66 See an [example BuildKit daemon configuration file](https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md). 67 68 If you don't specify a configuration file, Buildx looks for one by default in: 69 70 * `$BUILDX_CONFIG/buildkitd.default.toml` 71 * `$DOCKER_CONFIG/buildx/buildkitd.default.toml` 72 * `~/.docker/buildx/buildkitd.default.toml` 73 74 Note that if you create a `docker-container` builder and have specified 75 certificates for registries in the `buildkitd.toml` configuration, the files 76 will be copied into the container under `/etc/buildkit/certs` and configuration 77 will be updated to reflect that. 78 79 ### <a name="buildkitd-flags"></a> Specify options for the BuildKit daemon (--buildkitd-flags) 80 81 ```text 82 --buildkitd-flags FLAGS 83 ``` 84 85 Adds flags when starting the BuildKit daemon. They take precedence over the 86 configuration file specified by [`--buildkitd-config`](#buildkitd-config). See 87 `buildkitd --help` for the available flags. 88 89 ```text 90 --buildkitd-flags '--debug --debugaddr 0.0.0.0:6666' 91 ``` 92 93 #### BuildKit daemon network mode 94 95 You can specify the network mode for the BuildKit daemon with either the 96 configuration file specified by [`--buildkitd-config`](#buildkitd-config) using the 97 `worker.oci.networkMode` option or `--oci-worker-net` flag here. The default 98 value is `auto` and can be one of `bridge`, `cni`, `host`: 99 100 ```text 101 --buildkitd-flags '--oci-worker-net bridge' 102 ``` 103 104 > **Note** 105 > 106 > Network mode "bridge" is supported since BuildKit v0.13 and will become the 107 > default in next v0.14. 108 109 ### <a name="driver"></a> Set the builder driver to use (--driver) 110 111 ```text 112 --driver DRIVER 113 ``` 114 115 Sets the builder driver to be used. A driver is a configuration of a BuildKit 116 backend. Buildx supports the following drivers: 117 118 * `docker` (default) 119 * `docker-container` 120 * `kubernetes` 121 * `remote` 122 123 For more information about build drivers, see [here](https://docs.docker.com/build/drivers/). 124 125 #### `docker` driver 126 127 Uses the builder that is built into the Docker daemon. With this driver, 128 the [`--load`](buildx_build.md#load) flag is implied by default on 129 `buildx build`. However, building multi-platform images or exporting cache is 130 not currently supported. 131 132 #### `docker-container` driver 133 134 Uses a BuildKit container that will be spawned via Docker. With this driver, 135 both building multi-platform images and exporting cache are supported. 136 137 Unlike `docker` driver, built images will not automatically appear in 138 `docker images` and [`build --load`](buildx_build.md#load) needs to be used 139 to achieve that. 140 141 #### `kubernetes` driver 142 143 Uses Kubernetes pods. With this driver, you can spin up pods with defined 144 BuildKit container image to build your images. 145 146 Unlike `docker` driver, built images will not automatically appear in 147 `docker images` and [`build --load`](buildx_build.md#load) needs to be used 148 to achieve that. 149 150 #### `remote` driver 151 152 Uses a remote instance of BuildKit daemon over an arbitrary connection. With 153 this driver, you manually create and manage instances of buildkit yourself, and 154 configure buildx to point at it. 155 156 Unlike `docker` driver, built images will not automatically appear in 157 `docker images` and [`build --load`](buildx_build.md#load) needs to be used 158 to achieve that. 159 160 ### <a name="driver-opt"></a> Set additional driver-specific options (--driver-opt) 161 162 ```text 163 --driver-opt OPTIONS 164 ``` 165 166 Passes additional driver-specific options. 167 For information about available driver options, refer to the detailed 168 documentation for the specific driver: 169 170 * [`docker` driver](https://docs.docker.com/build/drivers/docker/) 171 * [`docker-container` driver](https://docs.docker.com/build/drivers/docker-container/) 172 * [`kubernetes` driver](https://docs.docker.com/build/drivers/kubernetes/) 173 * [`remote` driver](https://docs.docker.com/build/drivers/remote/) 174 175 ### <a name="leave"></a> Remove a node from a builder (--leave) 176 177 The `--leave` flag changes the action of the command to remove a node from a 178 builder. The builder needs to be specified with `--name` and node that is removed 179 is set with `--node`. 180 181 ```console 182 $ docker buildx create --name mybuilder --node mybuilder0 --leave 183 ``` 184 185 ### <a name="name"></a> Specify the name of the builder (--name) 186 187 ```text 188 --name NAME 189 ``` 190 191 The `--name` flag specifies the name of the builder to be created or modified. 192 If none is specified, one will be automatically generated. 193 194 ### <a name="node"></a> Specify the name of the node (--node) 195 196 ```text 197 --node NODE 198 ``` 199 200 The `--node` flag specifies the name of the node to be created or modified. If 201 you don't specify a name, the node name defaults to the name of the builder it 202 belongs to, with an index number suffix. 203 204 ### <a name="platform"></a> Set the platforms supported by the node (--platform) 205 206 ```text 207 --platform PLATFORMS 208 ``` 209 210 The `--platform` flag sets the platforms supported by the node. It expects a 211 comma-separated list of platforms of the form OS/architecture/variant. The node 212 will also automatically detect the platforms it supports, but manual values take 213 priority over the detected ones and can be used when multiple nodes support 214 building for the same platform. 215 216 ```console 217 $ docker buildx create --platform linux/amd64 218 $ docker buildx create --platform linux/arm64,linux/arm/v7 219 ``` 220 221 ### <a name="use"></a> Automatically switch to the newly created builder (--use) 222 223 The `--use` flag automatically switches the current builder to the newly created 224 one. Equivalent to running `docker buildx use $(docker buildx create ...)`.