Skip to content

fix(ecs): honor containerDefinition.entryPoint in docker run#734

Merged
vieiralucas merged 2 commits intomainfrom
fix-ecs-entrypoint
Apr 24, 2026
Merged

fix(ecs): honor containerDefinition.entryPoint in docker run#734
vieiralucas merged 2 commits intomainfrom
fix-ecs-entrypoint

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Apr 24, 2026

Summary

  • ECS runtime read command[] but silently dropped entryPoint[]. docker run <image> <command...> exec'd the first arg (typically -c) as the program — empty stdout, exit 0.
  • ecr_push_then_ecs_run_task_pulls_image has been red on every E2E run since PR feat(ecr-ecs-lambda): wire fakecloud ECR into ECS + Lambda image pull #726 because of this. The test sets entry_point("/bin/sh") and command("-c") / command("echo from-ecr ..."); without --entrypoint the container produces no logs and the from-ecr assertion fails.
  • Fix: read entryPoint from the container definition and forward it via docker --entrypoint <first> plus any remaining elements as positional args before command[]. Matches docker's ENTRYPOINT + CMD composition.

Test plan

  • cargo check -p fakecloud-ecs
  • cargo clippy -p fakecloud-ecs --all-targets
  • cargo fmt --check -p fakecloud-ecs
  • CI E2E general-1 (the partition that runs ecr_cross_service) goes green

Summary by cubic

Honor containerDefinition.entryPoint when running ECS tasks by passing the first element to docker run as --entrypoint and inserting remaining elements before command[]. Restores Docker ENTRYPOINT+CMD behavior (e.g., /bin/sh -c ...), fixes ecr_push_then_ecs_run_task_pulls_image, and adds exponential-backoff retries to the seed docker pull to avoid public ECR rate limits.

Written for commit 62f5bd4. Summary will update on new commits.

The ECS runtime was reading `command[]` but silently dropping
`entryPoint[]` from the container definition. Tasks that relied on an
explicit entryPoint (very common for `["/bin/sh","-c"]`-style wrappers)
ended up running `docker run <image> <command...>` which exec'd the
first command arg as the program — usually `-c`, which alpine et al.
treat as a missing binary, exiting 0 with no stdout.

This broke `ecr_push_then_ecs_run_task_pulls_image` on the very first
run after the test landed: the task printed nothing, captured logs
came back empty, and the assertion failed. The test was merged red in
PR #726 and has been failing on every E2E run since.

Read `entryPoint` alongside `command` and forward it to docker via
`--entrypoint` (single executable) plus any remaining elements as
positional args before `command[]`. That mirrors how docker composes
ENTRYPOINT + CMD at exec time and covers both the single-executable and
multi-element cases.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

❌ Patch coverage is 0% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/fakecloud-ecs/src/runtime.rs 0.00% 19 Missing ⚠️

📢 Thoughts on this report? Let us know!

`docker pull public.ecr.aws/docker/library/alpine:3.20` in `seed_image`
fails intermittently with `toomanyrequests: Rate exceeded`. Public ECR
caps anonymous pulls at ~1 req/sec per source IP, and CI runners share
egress IPs with everything else in the same Azure region.

Wrap the seed pull in a 6-attempt exponential-backoff retry that only
triggers on the rate-limit signature (`toomanyrequests` /
`Rate exceeded`). Hard failures (network unreachable, missing image)
still fail fast on the first attempt so we don't waste 5 minutes
backing off a real bug.
@vieiralucas vieiralucas merged commit 5e8e6bf into main Apr 24, 2026
48 checks passed
@vieiralucas vieiralucas deleted the fix-ecs-entrypoint branch April 24, 2026 15:32
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