1
0
mirror of https://github.com/docker/cli.git synced 2025-07-29 06:01:13 +03:00

add top-level "docker bake" command as alias for "docker buildx bake"

The [`docker buildx bake`][1] command has reached GA; this patch adds
a top-level `docker bake` command as alias for `docker buildx bake` to
improve discoverability and make it more convenient to use.

With this patch:

    docker --help

    Usage:  docker [OPTIONS] COMMAND

    A self-sufficient runtime for containers

    Common Commands:
      run         Create and run a new container from an image
      exec        Execute a command in a running container
      ps          List containers
      build       Build an image from a Dockerfile
      bake        Build from a file
      pull        Download an image from a registry
      push        Upload an image to a registry
      images      List images
    ...

The command is hidden if buildx is not installed;

    docker --help
    Usage:  docker [OPTIONS] COMMAND

    A self-sufficient runtime for containers

    Common Commands:
      run         Create and run a new container from an image
      exec        Execute a command in a running container
      ps          List containers
      build       Build an image from a Dockerfile
      pull        Download an image from a registry
      push        Upload an image to a registry
      images      List images
    ...

We can do some tweaking after this; currently it show an error
in situations where buildx is missing. We don't account for
"DOCKER_BUILDKIT=0", because this is a new feature that requires
buildx, and cannot be "disabled";

buildx missing;

    docker bake
    ERROR: bake requires the buildx component but it is missing or broken.
           Install the buildx component to use bake:
           https://docs.docker.com/go/buildx/

BuildKit disabled:

    DOCKER_BUILDKIT=0 docker bake
    ERROR: bake requires the buildx component but it is missing or broken.
           Install the buildx component to use bake:
           https://docs.docker.com/go/buildx/

[1]: https://www.docker.com/blog/ga-launch-docker-bake/

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-03-21 13:25:59 +01:00
parent e937b52210
commit adb0abaec5
6 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,12 @@
# docker bake
<!---MARKER_GEN_START-->
Build from a file
### Aliases
`docker buildx bake`
<!---MARKER_GEN_END-->

View File

@ -8,6 +8,7 @@ The base command for the Docker CLI.
| Name | Description |
|:------------------------------|:------------------------------------------------------------------------------|
| [`attach`](attach.md) | Attach local standard input, output, and error streams to a running container |
| [`bake`](bake.md) | Build from a file |
| [`build`](build.md) | Build an image from a Dockerfile |
| [`builder`](builder.md) | Manage builds |
| [`checkpoint`](checkpoint.md) | Manage checkpoints |