Official CLI for Depot - you can use the CLI to build Docker images via Depot's remote builder infrastructure.
⚡ Depot provides cloud-hosted container builder machines - our builders are quick, running on native hardware. Build caching is fully managed with no extra configuration.
For Mac, you can install the CLI with Homebrew:
brew install depot/tap/depot
For Linux, you can install with our installation script:
# Install the latest version
curl -L https://depot.dev/install-cli.sh | sh
# Install a specific version
curl -L https://depot.dev/install-cli.sh | sh -s 2.17.0
For all other platforms, you can download the binary directly from the latest release.
- Run
depot login
to authenticate with your Depot account. cd
to your project directory.- Run
depot init
to link the local directory with a Depot project - this will create adepot.json
file in the current directory. - Run
depot build -t repo/image:tag .
Run a Docker build from a HCL, JSON, or Compose file using Depot's remote builder infrastructure. This command accepts all the command line flags as Docker's docker buildx bake
command, you can run depot bake --help
for the full list.
The bake
command needs to know which project id to route the build to. For passing the project id you have three options available to you:
- Run
depot init
at the root of your repository and commit the resultingdepot.json
file - Use the
--project
flag in yourdepot bake
command - Set the
DEPOT_PROJECT_ID
environment variable which will be automatically detected
By default, depot bake
will leave the built image in the remote builder cache. If you would like to download the image to your local Docker daemon (for instance, to docker run
the result), you can use the --load
flag.
Alternatively, to push the image to a remote registry directly from the builder instance, you can use the --push
flag.
The bake
command allows you to define all of your build targets in a central file, either HCL, JSON, or Compose. You can then pass that file to the bake
command and Depot will build all of the target images with all of their options (i.e. platforms, tags, build arguments, etc.).
Example
An example docker-bake.hcl
file:
group "default" {
targets = ["original", "db"]
}
target "original" {
dockerfile = "Dockerfile"
platforms = ["linux/amd64", "linux/arm64"]
tags = ["example/app:test"]
}
target "db" {
dockerfile = "Dockerfile.db"
platforms = ["linux/amd64", "linux/arm64"]
tags = ["example/db:test"]
}
To build all of the images we just need to call bake
:
depot bake -f docker-bake.hcl
If you want to build a specific target in the bake file, you can specify it in the bake
command:
depot bake -f docker-bake.hcl original
Runs a Docker build using Depot's remote builder infrastructure. This command accepts all the command line flags as Docker's docker buildx build
command, you can run depot build --help
for the full list.
The build
command needs to know which project id to route the build to. For passing the project id you have three options available to you:
- Run
depot init
at the root of your repository and commit the resultingdepot.json
file - Use the
--project
flag in yourdepot build
command - Set the
DEPOT_PROJECT_ID
environment variable which will be automatically detected
By default, depot build
will leave the built image in the remote builder cache. If you would like to download the image to your local Docker daemon (for instance, to docker run
the result), you can use the --load
flag.
Alternatively, to push the image to a remote registry directly from the builder instance, you can use the --push
flag.
Example
# Build remotely
depot build -t repo/image:tag .
# Build remotely, download the container locally
depot build -t repo/image:tag . --load
# Build remotely, push to a registry
depot build -t repo/image:tag . --push
Interact with the cache associated with a Depot project. The cache
command consists of subcommands for each operation.
Reset the cache of the Depot project to force a new empty cache volume to be created.
Example
Reset the cache of the current project ID in the root depot.json
depot cache reset .
Reset the cache of a specific project ID
depot cache reset --project 12345678910
Interact with Depot projects and builds.
Display an interactive listing of current Depot projects. Selecting a specific project will display the latest builds.
To return from the latest builds to projects, press ESC
.
To exit type q
or ctrl+c
Example
depot list projects
Display the latest Depot builds for a project. By default the command runs an interactive listing of depot builds showing status and build duration.
To exit type q
or ctrl+c
Example
List builds for the project in the current directory.
depot list builds
Example
List builds for a specific project ID
depot list builds --project 12345678910
Example
The list command can output build information to stdout with the --output
option. It supports json
and csv
.
Output builds in JSON for the project in the current directory.
depot list builds --output json
Initialize an existing Depot project in the current directory. The CLI will display an interactive list of your Depot projects for you to choose from, then write a depot.json
file in the current directory with the contents {"projectID": "xxxxxxxxxx"}
.
Example
depot init
Authenticates with your Depot account, automatically creating and storing a personal API token on your local machine.
Example
depot login
PR contributions are welcome! The CLI codebase is evolving rapidly, but we are happy to work with you on your contribution.
MIT License, see LICENSE