google / google/go-containerregistry
`crane mutate` deletes Cmd if you try to override the `--entrypoint` without `--cmd`
- Dominant language
- Go
- Stars
- 4k
- Forks
- 686
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 26
Description
### Describe the bug
Given a base image with Entrypoint + Cmd;
`crane mutate --entrypoint ...` without also specifying `--cmd` deletes the `Cmd`. You end up with an Entrypoint only.
### To Reproduce
As above
### Expected behavior
Expected it to preserve the original Cmd, and override the Entrypoint only.
Deleting Cmd is unexpected, Dockerfile syntax `ENTRYPOINT [...]` does not do that. Ultimately to use `crane mutate`, you have to look up the base image, get .Config.Cmd, and re-add it as --cmd if you are using --entrypoint alone. This is possible! But not expected behaviour
### Additional context
Add any other context about the problem here.
- Output of `crane version`: 0.19.1, but there are no relevant commits since then.
Contributor guide
Research direction
Start with the `crane mutate` command and reproduce the case using a base image with both Entrypoint and Cmd, providing only `--entrypoint`. Trace the handling of `--entrypoint` and `--cmd`; done means the original Cmd remains when only the Entrypoint is overridden, with regression coverage for this behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100