Skip to content

additional_contexts with service: syntax not supported #422

@slaskis

Description

@slaskis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions