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.
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.
With those two things complete, you can then login to Depot via the CLI:
Once you're logged in, you can configure Depot inside of your git repository by running 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
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
depot build -t my-image:latest --load .
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 .
If you're using Docker Compose, you can configure your
docker-compose.yml file just as you usually would. You can then build your images inside of a compose file via our
depot bake -f docker-compose.yml --load
bake command concurrently builds all of the images defined in your compose file on a Depot builder with persistent caching. After the build, the
--load flag will download the images locally. Once the build is complete, you can run your compose file as you usually would:
depot bake -f docker-compose.yml --load && docker compose up
bake command effectively replaces
docker compose build with
depot bake and allows you to get significantly faster image builds while still being able to leverage Docker Compose.
docker compose up expects the containers built via a compose file to specify a tag that matches
directoryname-servicename. An example is shown below where the project is in a
version: '3.9' services: bar: build: context: . tags: - foo-bar