Dev Containers are becoming a popular way to leverage a container as a fully featured development environment directly integrated with Visual Studio Code. You can open any folder inside a container and use the full power of VS Code inside.
With Depot, you can build your Dev Containers on demand with instant shared caching across your entire team.
First, you will need to make sure you have installed the depot
CLI and configured a project.
depot
CLIOnce the CLI is installed, you can configure your environment:
depot login
to login to your Depot accountdepot init
to link your project to your repository; this will create a depot.json
directory in the current directoryNote: You can also connect depot
to your project by passing the DEPOT_PROJECT_ID
environment variable
Dev Containers uses the docker buildx build
command internally to build the container image. You can configure Depot as a plugin for the Docker CLI and Buildx with the following command:
depot configure-docker
The configure-docker
command is a one-time operation that routes any docker build
or docker buildx build
commands to Depot builders.
There are multiple options for building your Dev Container:
devcontainer
CLI:devcontainer build --workspace-folder .
[4 ms] @devcontainers/cli 0.50.0. Node.js v20.3.1. darwin 22.5.0 arm64.
[1878 ms] Start: Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /var/folders/w9/8yw9qm955bqcdwphh62w6fvr0000gn/T/devcontainercli/container-features/0.50.0-1690365763237/Dockerfile-with-features -t vsc-example-241be831c2682292f834c48f737ab308a1e901188127c5444a37dd0c0a339c90 --target dev_containers_target_stage --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /Users/user1/projects/proj/example
[+] Building 3.5s (19/19) FINISHED
=> [depot] build: https://depot.dev/orgs/orgid/projects/projectid/builds/9hh2rh7zkq 0.0s
=> [depot] launching arm64 builder 0.5s
=> [depot] connecting to arm64 builder 0.4s
=> [internal] load .dockerignore 0.4s
=> => transferring context: 116B 0.3s
=> [internal] load build definition from Dockerfile-with-features 0.3s
=> => transferring dockerfile: 601B 0.3s
=> [internal] load metadata for docker.io/library/node:16-alpine 0.4s
=> [build 1/5] FROM docker.io/library/node:16-alpine@sha256:6c381d5dc2a11dcdb693f0301e8587e43f440c90cdb8933eaaaabb905d44cdb9 0.0s
....
You should see something similar to the above in your VS Code or devcontainer
build logs. You can see that the docker buildx build
command is called, and then you see log lines for [depot] ...
that confirm your Docker image build is routed to Depot builders.