aws / aws-sam-cli

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
https://aws.amazon.com/serverless/sam/
Apache License 2.0
6.52k stars 1.17k forks source link

Could not find lambci/lambda:build-nodejs6.10 image locally and failed to pull it from docker #1119

Closed JacobSolomonUCF closed 5 years ago

JacobSolomonUCF commented 5 years ago

Description

Hi! I'm trying to build my dependencies using sam build --use-container. It was working on my project (nodejs8.10) however for some reason I am facing issues. Originally the lambci/lambda:build-nodejs8.10 image was correctly installed and working but now the build command fails. To ensure it wasn't my project configuration I have done the following.

I generated a new HelloWorld project using sam init --runtime nodejs6.10 and ran sam build --use-container with the boilerplate. It fails with the output below.

I have tried restarting/uninstalling/reinstalling docker, as well as aws-sam-cli. I have no proxies set. Not really sure what it could be.

Thanks!

Steps to reproduce

sam init --runtime nodejs6.10
cd sam-app
sam build --use-container --debug

Observed result

2019-04-12 20:32:12 Using SAM Template at /Users/jacob/Desktop/sam-app/template.yaml
2019-04-12 20:32:12 Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2019-04-12 20:32:12 Changing event name from before-call.apigateway to before-call.api-gateway
2019-04-12 20:32:12 Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2019-04-12 20:32:12 Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2019-04-12 20:32:12 Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2019-04-12 20:32:12 Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2019-04-12 20:32:12 Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
2019-04-12 20:32:12 Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
2019-04-12 20:32:12 Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
2019-04-12 20:32:12 Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
2019-04-12 20:32:12 Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
2019-04-12 20:32:12 Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2019-04-12 20:32:12 Changing event name from before-call.apigateway to before-call.api-gateway
2019-04-12 20:32:12 Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2019-04-12 20:32:12 Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2019-04-12 20:32:12 Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2019-04-12 20:32:12 Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2019-04-12 20:32:12 Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
2019-04-12 20:32:12 Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
2019-04-12 20:32:12 Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
2019-04-12 20:32:12 Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
2019-04-12 20:32:12 Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
2019-04-12 20:32:12 'build' command is called
2019-04-12 20:32:12 Starting Build inside a container
2019-04-12 20:32:12 No Parameters detected in the template
2019-04-12 20:32:12 2 resources found in the template
2019-04-12 20:32:12 Found Serverless function with name='HelloWorldFunction' and CodeUri='hello-world/'
2019-04-12 20:32:12 Trying paths: ['/Users/jacob/.docker/config.json', '/Users/jacob/.dockercfg']
2019-04-12 20:32:12 Found file at path: /Users/jacob/.docker/config.json
2019-04-12 20:32:12 Couldn't find auth-related section ; attempting to interpret as auth-only file
2019-04-12 20:32:12 Config entry for key stackOrchestrator is not auth config
2019-04-12 20:32:12 Building resource 'HelloWorldFunction'
2019-04-12 20:32:12 Trying paths: ['/Users/jacob/.docker/config.json', '/Users/jacob/.dockercfg']
2019-04-12 20:32:12 Found file at path: /Users/jacob/.docker/config.json
2019-04-12 20:32:12 Couldn't find auth-related section ; attempting to interpret as auth-only file
2019-04-12 20:32:12 Config entry for key stackOrchestrator is not auth config
2019-04-12 20:32:12 http://localhost:None "GET /v1.35/images/lambci/lambda:build-nodejs6.10/json HTTP/1.1" 404 107
2019-04-12 20:32:12 Looking for auth config
2019-04-12 20:32:12 No auth config in memory - loading from filesystem
2019-04-12 20:32:12 Trying paths: ['/Users/jacob/.docker/config.json', '/Users/jacob/.dockercfg']
2019-04-12 20:32:12 Found file at path: /Users/jacob/.docker/config.json
2019-04-12 20:32:12 Couldn't find auth-related section ; attempting to interpret as auth-only file
2019-04-12 20:32:12 Config entry for key stackOrchestrator is not auth config
2019-04-12 20:32:12 Looking for auth entry for 'docker.io'
2019-04-12 20:32:12 No entry found
2019-04-12 20:32:12 No auth config found
2019-04-12 20:32:27 http://localhost:None "POST /v1.35/images/create?tag=build-nodejs6.10&fromImage=lambci%2Flambda HTTP/1.1" 500 157
2019-04-12 20:32:27 Failed to download image with name lambci/lambda:build-nodejs6.10
2019-04-12 20:32:27 Container was not created. Skipping deletion
Traceback (most recent call last):
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/docker/api/client.py", line 261, in _raise_for_status
    response.raise_for_status()
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http+docker://localhost/v1.35/images/create?tag=build-nodejs6.10&fromImage=lambci%2Flambda

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/samcli/local/docker/manager.py", line 127, in pull_image
    result_itr = self.docker_client.api.pull(image_name, stream=True, decode=True)
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/docker/api/image.py", line 400, in pull
    self._raise_for_status(response)
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/docker/api/client.py", line 263, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 500 Server Error: Internal Server Error ("Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/samcli/local/docker/manager.py", line 83, in run
    self.pull_image(image_name)
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/samcli/local/docker/manager.py", line 130, in pull_image
    raise DockerImagePullFailedException(str(ex))
samcli.local.docker.manager.DockerImagePullFailedException: 500 Server Error: Internal Server Error ("Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/sam", line 11, in <module>
    load_entry_point('aws-sam-cli==0.14.2', 'console_scripts', 'sam')()
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/samcli/commands/build/command.py", line 95, in cli
    skip_pull_image, parameter_overrides)  # pragma: no cover
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/samcli/commands/build/command.py", line 133, in do_cli
    artifacts = builder.build()
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/samcli/lib/build/app_builder.py", line 99, in build
    lambda_function.runtime)
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/samcli/lib/build/app_builder.py", line 190, in _build_function
    runtime)
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/samcli/lib/build/app_builder.py", line 241, in _build_function_on_container
    self._container_manager.run(container)
  File "/usr/local/Cellar/aws-sam-cli/0.14.2/libexec/lib/python3.7/site-packages/samcli/local/docker/manager.py", line 87, in run
    "Could not find {} image locally and failed to pull it from docker.".format(image_name))
samcli.local.docker.manager.DockerImagePullFailedException: Could not find lambci/lambda:build-nodejs6.10 image locally and failed to pull it from docker.

Expected result

The image should be downloaded and the application built.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: macOS 10.14.14
  2. sam --version: 0.14.2
JacobSolomonUCF commented 5 years ago

Seem it was related to a proxy issue on my system.