Skip to content

dev_container: Respect runServices for Docker Compose#56293

Open
YauhenVasileusky wants to merge 4 commits into
zed-industries:mainfrom
YauhenVasileusky:improve-devcontainers-run-services-usage
Open

dev_container: Respect runServices for Docker Compose#56293
YauhenVasileusky wants to merge 4 commits into
zed-industries:mainfrom
YauhenVasileusky:improve-devcontainers-run-services-usage

Conversation

@YauhenVasileusky
Copy link
Copy Markdown

@YauhenVasileusky YauhenVasileusky commented May 9, 2026

This PR fixes Docker Compose dev containers starting every service in the compose project, even when devcontainer.json specifies runServices.

Previously, Zed deserialized runServices but did not use it when invoking Docker Compose. The startup command was:

docker compose ... up -d

With no service operands, Compose starts every enabled service in the project. This means unrelated services are started even when the devcontainer config asks to run only the primary service and its dependencies.

The fix propagates runServices into the Docker Compose build/start path so Zed invokes Compose with the requested services:

docker compose ... up -d devcontainer

Compose will still start services required by depends_on, but unrelated services are left untouched.

Reproduction

.devcontainer/devcontainer.json:

{
  "name": "Run Services",
  "dockerComposeFile": "../compose.yml",
  "service": "devcontainer",
  "runServices": ["devcontainer"],
  "workspaceFolder": "/workspace"
}

compose.yml:

services:
  devcontainer:
    image: ubuntu:24.04
    command: sleep infinity
    volumes:
      - .:/workspace
    depends_on:
      - database

  database:
    image: postgres:16-alpine
    environment:
      POSTGRES_PASSWORD: postgres

  unrelated:
    image: nginx:alpine

Expected: Zed starts devcontainer and database.

Before this fix: Zed also starts unrelated.

After this fix: unrelated remains stopped.

Closes: #57279

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • Fixed Docker Compose dev containers starting services not listed in runServices.

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 9, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @YauhenVasileusky on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label May 9, 2026
@YauhenVasileusky
Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label May 9, 2026
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 9, 2026

The cla-bot has been summoned, and re-checked this pull request!

@ChristopherBiscardi ChristopherBiscardi added the area:dev containers Feedback for Zed's dev containers feature label May 10, 2026
@maxdeviant maxdeviant changed the title Dev Containers: Respect runServices for Docker Compose dev_container: Respect runServices for Docker Compose May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev containers Feedback for Zed's dev containers feature cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dev_container: runServices is ignored for Docker Compose

3 participants