We use cookies to understand how people use Depot.
Guides

Docker

Running builds with Depot

To run builds with Depot via docker, you still need to connect the build to an active Depot project via the depot init and depot.json files or via the DEPOT_PROJECT_ID environment variable.

How to use Depot with Docker

Depot can directly integrate with your existing Docker workflows via a one-time configuration command from our depot CLI. See our instructions for installing our CLI if you still need to do so.

With the CLI installed, you can run configure-docker to configure your Docker CLI to use Depot as the default handler for docker build and docker buildx build:

depot configure-docker

Underneath the hood, the configure-docker command installs Depot as a Docker CLI plugin and sets the plugin as the default Docker builder (i.e., docker build). In addition, the command also installs a Depot buildx driver and sets that driver as the default driver for docker buildx build.

docker build

Once your docker environment is configured to use Depot, you can run your builds as usual.

docker build --platform linux/amd64,linux/arm64 .

If you have correctly configured your Depot project via depot init or DEPOT_PROJECT_ID, your build will automatically be sent to Depot for execution. You can confirm this by looking for log lines in the output that are prefixed with [depot].

docker buildx build

Similarly, once your environment is configured to use Depot, you can run your docker buildx build commands as usual.

docker buildx build --platform linux/amd64,linux/arm64 .

Again, you can confirm that builds are going to your Depot project by looking for log lines that are prefixed with [depot] or by checking out the builds for your project.

Using Depot with Docker Compose

Once the configure-docker command is executed, you can use Depot with Docker Compose without changing a single line of code. All you need to do is ensure you have a Depot project configured for your build. You can do this via:

  1. Setting a DEPOT_PROJECT_ID environment variable to the project ID of the project you want to use for builds
  2. Running depot init in the root of the repository in which you're building your image. The command creates a depot.json file that our plugin will detect.

Under the hood, docker compose build uses docker buildx build to build your images. As a result, you can use docker compose build as usual, and your builds will be sent to Depot.

docker compose build

Because of how Compose communicates with the buildx driver, there are a few things to be aware of:

  1. Confirming the build went to Depot is best done by going to the builds for your project
  2. A new build will be created for each service + architecture defined in your compose.yml file. For example, if you have a web service and a worker service and are building for linux/amd64 and linux/arm64, you will have four builds created in Depot.

If you prefer to use docker compose up that works as well. The up command will automatically build your images if not already built.

docker compose up