Skip to content

Add CMD ["sleep", "infinity"] to Dockerfiles #53

Description

@gatezh

Problem

Images inherit CMD ["node"] from the Node.js base image. When used with Docker Compose-based devcontainers, overrideCommand defaults to false, so VS Code does not inject its keep-alive sleep loop. The node process exits immediately in non-interactive/detached mode, killing the container.

With "image" mode in devcontainer.json this isn't visible because overrideCommand defaults to true and VS Code auto-injects the keep-alive. But any Docker Compose consumer hits this.

Error

Container starts, VS Code connects briefly, then:

Exit code 137
Shell server terminated (code: 137, signal: null)
Error response from daemon: container ... is not running

docker inspect shows the container exited with code 0 (main process finished normally), not OOM.

Fix

Add to both Dockerfiles:

CMD ["sleep", "infinity"]

Since these images exist solely as devcontainer images, there's no reason to preserve the Node base image's default CMD. This makes the images work correctly regardless of whether consumers use "image" mode or Docker Compose.

Affected images

  • ghcr.io/gatezh/devcontainer-images/claude-code
  • ghcr.io/gatezh/devcontainer-images/claude-code-sandbox

Activity

  1. added a commit that references this issue on Mar 26, 2026
    7204cf0
  2. gatezh commented on Mar 26, 2026

    @gatezh
    OwnerAuthor

    Fix in #54 — added CMD ["sleep", "infinity"] to both default and sandbox targets.

    Confirmed the overrideCommand asymmetry: defaults to true in image/Dockerfile mode (VS Code injects keep-alive) but false in Docker Compose mode (container dies). The explicit CMD makes both modes work and is a no-op when VS Code overrides it.

  3. added a commit that references this issue on Mar 26, 2026
    823fccd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions