microsoft / microsoft/aspire

Docker Compose deploy fails when Dockerfile final stage has no CMD/ENTRYPOINT (FROM scratch)

Open
#15,876 1 comment 0 reactions 0 assignees View on GitHub
area-deployment aspirifridays
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

## Description

When using a multi-stage Dockerfile where the final stage is `FROM scratch` (or any minimal base with no default command), Docker Compose deployment fails with "no command specified". This happens even when the container is only used as a build artifact (its image is referenced by another service's build).

## Expected behavior

If a resource's container is only used as a build dependency (e.g., its image is referenced in another service's Dockerfile `COPY --from=`), it shouldn't need a CMD/ENTRYPOINT. Aspire should either:

- Not add the container as a compose service if it's only a build artifact
- Or handle the "no command" case gracefully

## Workaround

Use a base image with a shell for the final stage (e.g., `FROM busybox` with `CMD ["true"]`), or restructure the Dockerfile to use a real runtime as the final stage.

## Environment

- Aspire SDK: 13.2.1 (TypeScript)
- Target: Docker Compose (`addDockerComposeEnvironment`)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.