-
Notifications
You must be signed in to change notification settings - Fork 4
fix: combine ENTRYPOINT and CMD from wrapped Dockerfile if present #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Claude finished @seanmcgary's task —— View job Code Review Complete ✅Reviewing PR #24: fix: combine ENTRYPOINT and CMD from wrapped Dockerfile if present Todo List:
Review SummaryThis PR correctly fixes the Docker ENTRYPOINT + CMD combination issue in ✅ Positive Aspects1. Correct Problem Identification & Solution
2. Code Quality
3. Minimal, Focused Change
🔍 Technical AnalysisDocker Behavior Alignment
Edge Cases Handled
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the handling of Docker image commands by properly combining ENTRYPOINT and CMD directives from wrapped Dockerfiles. Previously, the code only used CMD when present, which broke the common Docker pattern where ENTRYPOINT specifies a CLI binary and CMD provides subcommands/arguments.
Key Changes:
- Modified command extraction logic to concatenate
ENTRYPOINTandCMDarrays - Removed conditional logic that prioritized
CMDoverENTRYPOINT
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if len(originalCmd) == 0 && len(inspectResp.Config.Entrypoint) > 0 { | ||
| originalCmd = inspectResp.Config.Entrypoint | ||
| // Combine Entrypoint and Cmd to get full command | ||
| cmd := []string{} |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Use var cmd []string instead of cmd := []string{} to avoid allocating an empty slice that will be immediately replaced by append operations. This is more idiomatic and slightly more efficient.
| cmd := []string{} | |
| var cmd []string |
| originalCmd = inspectResp.Config.Entrypoint | ||
| // Combine Entrypoint and Cmd to get full command | ||
| cmd := []string{} | ||
| if len(inspectResp.Config.Entrypoint) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a test for this whole function?
Motivation:
In a Dockerfile, it is acceptable, and common, to specify an
ENTRYPOINTthat points to a cli-type binary that can accept multiple commands and then setCMDto a subcommand with args. Previously we were taking only theCMDif present, which would break if using the aforementioned pattern.Modifications:
Combined
ENTRYPOINTandCMDinto a single command that the wrapped container will call.Result:
It no longer breaks!
Testing:
All tests pass, tested functionality on a local build.
Open questions:
None