🔒 EXCLUSIVE: Build/bake - Collection

Table of contents

Bake is a feature of Docker Buildx that lets you define your build configuration using a declarative file, as opposed to specifying a complex CLI expression. It also lets you run multiple builds concurrently with a single invocation.

A Bake file can be written in HCL, JSON, or YAML formats, where the YAML format is an extension of a Docker Compose file. Here's an example Bake file in HCL format:

The group block defines a group of targets that can be built concurrently. Each target block defines a build target with its own configuration, such as the build context, Dockerfile, and tags.

To invoke a build using the above Bake file, you can run:

This executes the default group, which builds the frontend and backend targets concurrently.

Get started

To learn how to get started with Bake, head over to the Bake introduction.