Skip to content

fix(compose): support the entrypoint field in service definitions - #85

Open
itxtoledo wants to merge 1 commit into
us:mainfrom
itxtoledo:fix/compose-entrypoint
Open

fix(compose): support the entrypoint field in service definitions#85
itxtoledo wants to merge 1 commit into
us:mainfrom
itxtoledo:fix/compose-entrypoint

Conversation

@itxtoledo

Copy link
Copy Markdown
Contributor

Summary

Docker Compose's entrypoint: field was entirely ignored: ComposeService never parsed it, so any service relying on an entrypoint (e.g. entrypoint: ["/bin/sh", "-c"]) either launched with a mangled argv or failed to start with failed to find target executable ....

Apple's container CLI only accepts a single executable via --entrypoint <cmd> — a value with spaces like /bin/sh -c is treated as one executable path and fails to launch. This PR makes mocker mirror Docker's exec model (ENTRYPOINT [...] + CMD [...] concatenation) within that constraint.

Changes

  • ComposeFile: parse entrypoint: (list and shell/string form), include it in multi-file merge and in the config hash so containers are recreated when it changes.
  • ComposeOrchestrator: new pure helper resolveExec(entrypoint:command:) — the first entrypoint element becomes the --entrypoint executable and remaining elements are spliced ahead of the command argv.
  • run / create / compose run: --entrypoint values are now split on spaces (Docker shell-form semantics) and routed through the same helper, so mocker run --entrypoint "/bin/sh -c" works.
  • Tests: parsing (list + string + merge + hash) and resolveExec unit tests. Full suite: 453 tests pass.

Verification

Built locally and ran:

services:
  ep:
    image: alpine:latest
    entrypoint: ["/bin/sh", "-c"]
    command: ["echo COMPOSE_ENTRYPOINT_FIXED; sleep 300"]

mocker compose up -d + logs → COMPOSE_ENTRYPOINT_FIXED, container stays up. mocker run --entrypoint "/bin/sh -c" alpine echo RUN_EP_FLAG_FIXED → works (previously errored).

💘 Generated with Crush

Docker Compose's `entrypoint:` was never parsed, so services relying on
it (e.g. `["/bin/sh", "-c"]`) launched with a mangled argv or failed to
start. Apple's `container` runtime only accepts a single executable via
`--entrypoint`, so the first entrypoint element now becomes the
executable and the remaining elements are spliced ahead of the command
args, mirroring Docker's ENTRYPOINT + CMD concatenation. `mocker run`,
`create`, and `compose run` `--entrypoint` values are split on spaces
too, matching Docker's shell-form semantics.

💘 Generated with Crush

Assisted-by: Crush:deepseek-v4-flash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant