From 97b08f62bc456e88147b53095c0bfefbd7510621 Mon Sep 17 00:00:00 2001 From: Niklas Herder Date: Fri, 8 May 2026 14:48:21 +0200 Subject: [PATCH] chore(docker): ship awslocal wrapper in the -compat image (#746) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(docker): ship awslocal wrapper in the -compat image bin/awslocal was added to the repo in #638 but is not COPYed into any of the published Docker images. That makes existing LocalStack init scripts mounted at /etc/localstack/init/ready.d/ — which overwhelmingly use `awslocal kinesis …` rather than `aws --endpoint-url=… kinesis …` — fail with "command not found" on the supposedly drop-in -compat image. The script also needed an entry in .dockerignore: the file is allow-list style ("*" + "!path") and bin/awslocal was not in the allow list, so it never reached the build context. Without that line the COPY fails with "file not found in build context". Closes #744. The orthogonal SQS endpoint-resolver issue tracked in #745 is unaffected by this change — awslocal as written only exports AWS_ENDPOINT_URL, which the bundled botocore silently ignores for SQS. * fix(awslocal): pass --endpoint-url explicitly to honor hard-pin contract LocalStack's awslocal idiom is "hard-pin the endpoint" — that's the whole point of the wrapper. Setting AWS_ENDPOINT_URL alone is not sufficient: the bundled aws-cli/1.44.87 + botocore/1.42.97 silently bypasses the env var for SQS via service-specific endpoint resolvers, sending requests to public AWS. With real credentials in CI/dev, that would silently provision real SQS queues — surfacing as the InvalidClientTokenId error documented in #745. Inject --endpoint-url before "$@" so the user's own --endpoint-url (if any) still wins via last-flag-wins. Verified: awslocal sqs create-queue and list-queues now route to Floci; kinesis/s3 still work; awslocal env subcommand unaffected; user override behaves correctly. Addresses Copilot's review feedback on #746 and the awslocal arm of #745. --- .dockerignore | 1 + bin/awslocal | 5 ++++- docker/Dockerfile.compat | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index eede665231..01493fb126 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,5 @@ * +!bin/awslocal !docker/entrypoint.sh !docker/localstack-parity.sh !pom.xml diff --git a/bin/awslocal b/bin/awslocal index af9a4d01c3..6bdc6c9f44 100755 --- a/bin/awslocal +++ b/bin/awslocal @@ -27,4 +27,7 @@ export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:-test}" export AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:-test}" export AWS_DEFAULT_REGION="${_REGION}" -exec aws "$@" \ No newline at end of file +# Pass --endpoint-url explicitly: a few SDKs/services (notably SQS in older +# botocore) silently bypass AWS_ENDPOINT_URL via service-specific endpoint +# resolvers, sending the call to public AWS instead of Floci. +exec aws --endpoint-url "${_ENDPOINT}" "$@" \ No newline at end of file diff --git a/docker/Dockerfile.compat b/docker/Dockerfile.compat index ede2b3e268..d8fe77a874 100644 --- a/docker/Dockerfile.compat +++ b/docker/Dockerfile.compat @@ -13,4 +13,7 @@ RUN microdnf install -y --nodocs python3 python3-pip \ && microdnf clean all \ && rm -rf /root/.cache/pip +COPY bin/awslocal /usr/local/bin/awslocal +RUN chmod +x /usr/local/bin/awslocal + USER 1001