Bitbucket Pipeline "sam build" fails looking for local docker on Release 1.86.0
Description:
Release 1.86.0 causes the following error on my bitbucket pipeline when running sam build. Appears to be looking for local docker host='localhost', port=2375.
Reverting to v1.85.0 restores functional sam build results
Steps to reproduce:
- curl -L https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip -o aws-sam-cli-linux-x86_64.zip
- unzip aws-sam-cli-linux-x86_64.zip -d sam-installation
- ./sam-installation/install
- npm install -g typescript
- npm install --unsafe-perm=true -g esbuild
- npm run build
- sam build
Observed result:
+ sam build
SAM CLI now collects telemetry to better understand customer needs.
You can OPT OUT and disable telemetry collection by setting the
environment variable SAM_CLI_TELEMETRY=0 in your shell.
Thanks for your help!
Learn More: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-telemetry.html
Error: Error while fetching server API version: HTTPConnectionPool(host='localhost', port=2375): Max retries exceeded with url: /version (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9c7d190750>: Failed to establish a new connection: [Errno 111] Connection refused'))
Traceback:
File "click/core.py", line 1055, in main
File "click/core.py", line 1657, in invoke
File "click/core.py", line 1404, in invoke
File "click/core.py", line 760, in invoke
File "click/decorators.py", line 84, in new_func
File "click/core.py", line 760, in invoke
File "samcli/lib/telemetry/metric.py", line 184, in wrapped
File "samcli/lib/telemetry/metric.py", line 149, in wrapped
File "samcli/lib/utils/version_checker.py", line 42, in wrapped
File "samcli/cli/main.py", line 95, in wrapper
File "samcli/commands/build/command.py", line 179, in cli
File "samcli/commands/build/command.py", line 275, in do_cli
File "samcli/commands/build/build_context.py", line 256, in run
File "samcli/lib/build/app_builder.py", line 159, in __init__
File "docker/client.py", line 96, in from_env
File "docker/client.py", line 45, in __init__
File "docker/api/client.py", line 197, in __init__
File "docker/api/client.py", line 221, in _retrieve_server_version
An unexpected error was encountered while executing "sam build".
Search for an existing issue:
https://github.com/aws/aws-sam-cli/issues?q=is%3Aissue+is%3Aopen+Bug%3A%20sam%20build%20-%20DockerException
Or create a bug report:
https://github.com/aws/aws-sam-cli/issues/new?template=Bug_report.md&title=Bug%3A%20sam%20build%20-%20DockerException
Expected result:
functional sam builds
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Bitbucket pipelines build step using image: atlassian/default-image:3
Same here. My BitBucket Pipelines build broke from this latest release (same error output). Explicitly using version 1.85.0 causes them to succeed again. My builds use this image: mcr.microsoft.com/dotnet/sdk:6.0
Same thing happens here with AWS CodeBuild if docker is not running in the environment. As would happen with a lot of my projects.
The solution I've found is installing version 1.85.0 by force, but I would need to change a line of code in way too many buildspec files and would be operational caos.
In AWS CodeBuild the error looks something like this:
Error: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
243
Thanks for reporting this issue, we are actively working on this problem, will be providing updates soon.
I can confirm the same is hapenning for CircleCI when using cimg/base:edge as well.
Having the same issue in Gitlab CI when using the image nikolaik/python-nodejs:latest.
I am experiencing the same issue as well. I used the sam cli to create a pipeline and receive the following error:
[Container] 2023/06/07 02:28:08 Running command sam deploy --stack-name ${ENV_STACK_NAME} --template ${ENV_TEMPLATE} --capabilities CAPABILITY_IAM --region ${ENV_REGION} --s3-bucket ${ENV_BUCKET} --no-fail-on-empty-changeset --role-arn ${ENV_CLOUDFORMATION_EXECUTION_ROLE}
Error: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
All,
Sorry for the delay, we had to take extra time to validate to ensure things are working properly before patching. In you are in need of an immediate fix two options:
- make sure docker is running on the machine SAM CLI commands are run on
- downgrade the installed version of SAM CLI (1.85.0). Previous release artifact can be found in our Github Releases.
We appreciate the patience from the community as we get a patch out!
Please refrain from "+1" like comments, it adds unneeded noise. Instead, please thumbs up the original comment and follow the Issue for updates. Thanks!
Thanks for your patience. We've released v1.86.1 which should resolve this issue.
Please let us know if you are still experiencing problems.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.