fix(up): allow entrypoint and command together, place --entrypoint before image#80
Open
Cyb3rDudu wants to merge 2 commits intoMcrich23:mainfrom
Open
fix(up): allow entrypoint and command together, place --entrypoint before image#80Cyb3rDudu wants to merge 2 commits intoMcrich23:mainfrom
Cyb3rDudu wants to merge 2 commits intoMcrich23:mainfrom
Conversation
…fore image
Compose semantics treat `entrypoint` and `command` as composable: `entrypoint`
replaces the image's ENTRYPOINT, `command` becomes its argv tail. The current
code makes them mutually exclusive (`else if`) and appends `--entrypoint` plus
all entrypoint elements *after* the image, so:
entrypoint: ["/bin/bash", "-c"]
command:
- |
sed -i ... /etc/httpd.conf
exec httpd-foreground
silently drops `command`, and `container run` only takes one executable for
`--entrypoint` anyway.
This pulls the translation into a static helper:
- first `entrypoint` element → `--entrypoint <bin>` (before the image)
- rest of `entrypoint` + every `command` element → positional args after the image
Fixes Mcrich23#77.
8 static cases for the pure helper, including the bash -c heredoc shape from Mcrich23#77. One dynamic test that runs sh -c with a multi-line script and asserts the container is actually running afterward — on the buggy code, command is dropped and sh exits.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Compose files using
entrypoint: ["/bin/bash","-c"](orsh) plus a multi-linecommand:heredoc silently drop thecommand:part — the script never runs:Two bugs in
ComposeUp.swift::configService:entrypointandcommandgo through anelse if, so setting both meanscommandis dropped.--entrypointis appended after the image and gets every entrypoint element — butcontainer run --entrypointonly takes one binary.Fix pulls the translation into a static helper:
entrypointelement →--entrypoint <bin>(before the image)entrypoint+ everycommandelement → positional args after the imageTests: 8 static cases for the helper covering all combinations (nil/empty/single/multi entrypoint × nil/command, including the bash-c heredoc shape from #77), plus one dynamic test that runs
sh -cwith a multi-line script and asserts the container is actually running afterward.Fixes #77.