We use cookies to understand how people use Depot.

Local Development

Why use Depot for local development?

Using Depot's remote builders for local development allows you to get faster Docker image builds with the entire Docker layer cache instantly available across builds. The cache is shared across your entire team who has access to a given Depot project, allowing you to reuse build results and cache across your entire team for faster local development. Additionally, routing the image build to remote builders frees your local machine's CPU and memory resources.

Cache sharing with local builds

There is nothing additional you need to configure to share your build cache across your team for local builds. If your team members can access the Depot project, they will automatically share the same build cache. So, if you build an image locally, your team members can reuse the layers you built in their own builds.

How to use Depot for local development

To leverage Depot locally, install the depot CLI tool and configure your Depot project, if you haven't already.

With those two things complete, you can then login to Depot via the CLI:

depot login

Once you're logged in, you can configure Depot inside of your git repository by running the init command:

depot init

The init command writes a depot.json file to the root of your repository with the Depot project ID that you selected. Alternatively, you can skip the init command if you'd like and use the --project flag on the build command to specify the project ID.

You can run a build with Depot locally by running the build command:

depot build -t my-image:latest .

By default, Depot won't return you the built image locally. Instead, the built image and the layers produced will remain in the build cache. However, if you'd like to download the image locally, for instance, so you can docker run it, you can specify the --load flag:

depot build -t my-image:latest --load .

Using docker build

You can also run a build with Depot locally via the docker build or docker buildx build commands. To do so, you'll need to run depot configure-docker to configure your Docker CLI to use Depot as the default builder:

depot configure-docker
docker build -t my-image:latest .

For a full guide on using Depot via your existing docker build of docker compose commands, see our Docker integration guide.