ashupednekar / ashupednekar/compose

Exclude Commands from Docker Compose for Certain Containers

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Some container images, such as **Bitnami** and **Distroless**, expect the container's default entrypoint to be used, and **do not allow overriding the command** via Docker Compose. Currently, the compose tool is **including the command field** from Helm-rendered manifests, leading to invalid arguments and startup failures.

This bugfix ensures that commands are **conditionally excluded** for containers that rely on their default entrypoint.

---

## Proposed Implementation

### 1. Detection
- Identify containers that require their default entrypoint:
- Bitnami images
- Distroless images
- Optionally allow a **configurable whitelist** for other images
- Determine if the Helm chart specifies a command or args.

### 2. Docker Compose Translation
- **Skip the `command` field** in the generated `docker-compose.yaml` for images in the whitelist.
- Preserve commands for other images that explicitly override the default entrypoint.

### 3. Configuration Option
- Add CLI or config support:
- `--skip-default-command` to explicitly disable commands for certain images.
- Allow users to specify additional image names to exclude.

---

## Challenges
- Need to maintain **compatibility** with Helm charts that intentionally override commands.
- Ensure **sidecars** or other microservices are not affected by command skipping.
- Consider **dynamic detection** vs. **manual whitelist** for flexibility.

---

## Benefits
- Fixes startup failures for Bitnami and Distroless containers.
- Avoids invalid argument errors caused by unnecessary command injection.
- Improves Helm-to-Docker Compose conversion reliability.

---

## Acceptance Criteria
- Helm charts using Bitnami or Distroless images **start successfully** without overriding the default entrypoint.
- Command field is **omitted** in Docker Compose for whitelisted images.
- Commands are preserved for images that require explicit overrides.
- CLI/config options allow **manual control** over command skipping.
- Generated `docker-compose.yaml` passes validation with `docker-compose config`.

---

## Example

### Current (invalid for Distroless)
```
services:
my-app:
image: gcr.io/distroless/base:latest
command: ["./start.sh"]
```

### Fixed (command excluded)
```
services:
my-app:
image: gcr.io/distroless/base:latest
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the compose tool's Helm-to-Docker Compose translation and its CLI/config handling. Trace how commands from Helm-rendered manifests become the generated docker-compose.yaml, then validate the result with docker-compose config. Done means default commands can be skipped for selected images while explicit commands remain for other containers.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, go, helm
Domain
cli, devops
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.