You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/examples.md
+71-2Lines changed: 71 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -271,7 +271,7 @@ A newly spawned agent won't contain any of the docker caches for the first run w
271
271
272
272
```yaml
273
273
steps:
274
-
- label: ":docker Build an image"
274
+
- label: ":docker: Build an image"
275
275
plugins:
276
276
- docker-compose#v5.4.1:
277
277
build: app
@@ -295,7 +295,7 @@ The values you add in the `cache-from` will be mapped to the corresponding servi
295
295
296
296
```yaml
297
297
steps:
298
-
- label: ":docker Build an image"
298
+
- label: ":docker: Build an image"
299
299
plugins:
300
300
- docker-compose#v5.4.1:
301
301
build: app
@@ -312,3 +312,72 @@ steps:
312
312
push:
313
313
- app:myregistry:port/myrepo/myapp:latest
314
314
```
315
+
316
+
### Create, Use and Remove Builder Instances
317
+
318
+
#### Create
319
+
320
+
Most Docker setups, unless configured, will use the `docker` Builder Driver by default. More details on it [here](https://docs.docker.com/build/builders/drivers/docker/).
321
+
322
+
The `docker` driver can handle most situations but for advance features with the Docker, different Builder Drivers are required and this requires a Builder Instance being created first, which can be done manually or with the Plugin. To create a Builder Instance using a chosen Driver, requires the `name`, `driver` and `create` parameters:
323
+
324
+
```yaml
325
+
steps:
326
+
- label: ":docker: Build an image"
327
+
plugins:
328
+
- docker-compose#v5.4.1:
329
+
build: app
330
+
push: app:index.docker.io/myorg/myrepo:my-branch
331
+
cache-from:
332
+
- "app:myregistry:port/myrepo/myapp:my-branch"
333
+
- "app:myregistry:port/myrepo/myapp:latest"
334
+
driver:
335
+
name: container
336
+
driver: docker-container
337
+
create: true
338
+
```
339
+
340
+
**If a Builder Instance with the same `name` already exists, it will not be recreated.**
341
+
342
+
#### Use
343
+
344
+
By default, Builder Instances specified by `name` or that are created with `create` are not used, and the default Builder Instance on the Agent will be used. To use a Builder Instance, requires the `name` and `use` parameters and the Builder Instance to exist:
345
+
346
+
```yaml
347
+
steps:
348
+
- label: ":docker: Build an image"
349
+
plugins:
350
+
- docker-compose#v5.4.1:
351
+
build: app
352
+
push: app:index.docker.io/myorg/myrepo:my-branch
353
+
cache-from:
354
+
- "app:myregistry:port/myrepo/myapp:my-branch"
355
+
- "app:myregistry:port/myrepo/myapp:latest"
356
+
driver:
357
+
name: container
358
+
use: true
359
+
```
360
+
361
+
#### Remove
362
+
363
+
By default, Builder Instances specified by `name` or that are created with `create` are not removed after the Job finishs. To remove a Builder Instance, requires the `name` and `remove` parameters and the Builder Instance to exist:
364
+
365
+
```yaml
366
+
steps:
367
+
- label: ":docker: Build an image"
368
+
plugins:
369
+
- docker-compose#v5.4.1:
370
+
build: app
371
+
push: app:index.docker.io/myorg/myrepo:my-branch
372
+
cache-from:
373
+
- "app:myregistry:port/myrepo/myapp:my-branch"
374
+
- "app:myregistry:port/myrepo/myapp:latest"
375
+
driver:
376
+
name: container
377
+
remove: true
378
+
```
379
+
380
+
**Removing a Builder Instance by default will remove the daemon running it and its state (which can be used for cache).**
381
+
**To keep the daemon or state, use the `keep-daemon` or `keep-state` parameters.**
382
+
**These parameter are only applicable with specific Drivers, for detail see [`docker buildx rm`](https://docs.docker.com/reference/cli/docker/buildx/rm/).**
0 commit comments