Docker Compose supports additional_contexts with service: syntax to reference another service's build output as a build context. This works with docker compose build (or docker bake) but fails with depot bake.
This pattern is useful for monorepos where multiple services share a common base image with pre-built dependencies. The base is built once and reused by all app images.
Minimal reproduction
services:
base:
image: example-base
build:
dockerfile_inline: |
FROM alpine AS base
RUN echo "base"
app:
image: example-app
build:
dockerfile_inline: |
FROM base
RUN echo "app"
additional_contexts:
base: service:base
# Works
docker bake
# Fails
depot bake
Error
Error: failed to get build context base: stat service:base: no such file or directory
Expected behavior
Depot should resolve service:base to the build output of the base service, matching docker compose build behavior.
Docker Compose supports
additional_contextswithservice:syntax to reference another service's build output as a build context. This works withdocker compose build(ordocker bake) but fails withdepot bake.This pattern is useful for monorepos where multiple services share a common base image with pre-built dependencies. The base is built once and reused by all app images.
Minimal reproduction
Error
Expected behavior
Depot should resolve
service:baseto the build output of thebaseservice, matchingdocker compose buildbehavior.