aws-sam-cli: Sam local command does not work on Ubuntu 16.04 venv
Sam local does not work on Ubuntu 16.04 venv
Trying to run sam local start-api
, I ran into a docker blocker. Asking for installation, even though installed.
Steps to reproduce
Run sam local start-api
Observed result
2019-01-09 14:14:55 Found credentials in shared credentials file: ~/.aws/credentials
Error: Running AWS SAM projects locally requires Docker. Have you got it installed?
With the --debug
flag set:
2019-01-09 14:19:29 Using SAM Template at /home/israel/lambda/sam-app/template.yaml
2019-01-09 14:19:29 Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2019-01-09 14:19:29 Changing event name from before-call.apigateway to before-call.api-gateway
2019-01-09 14:19:29 Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2019-01-09 14:19:29 Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2019-01-09 14:19:29 Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2019-01-09 14:19:29 Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2019-01-09 14:19:29 Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
2019-01-09 14:19:29 Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
2019-01-09 14:19:29 Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
2019-01-09 14:19:29 Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
2019-01-09 14:19:29 Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
2019-01-09 14:19:29 Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2019-01-09 14:19:29 Changing event name from before-call.apigateway to before-call.api-gateway
2019-01-09 14:19:29 Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2019-01-09 14:19:29 Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2019-01-09 14:19:29 Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2019-01-09 14:19:29 Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2019-01-09 14:19:29 Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
2019-01-09 14:19:29 Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
2019-01-09 14:19:29 Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
2019-01-09 14:19:29 Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
2019-01-09 14:19:29 Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
2019-01-09 14:19:29 local start-api command is called
2019-01-09 14:19:29 Looking for credentials via: env
2019-01-09 14:19:29 Looking for credentials via: assume-role
2019-01-09 14:19:29 Looking for credentials via: shared-credentials-file
2019-01-09 14:19:29 Found credentials in shared credentials file: ~/.aws/credentials
2019-01-09 14:19:29 Loading JSON file: /home/israel/lambda/AWS-AppSync-Lambda-GraphQL-API/venv/local/lib/python2.7/site-packages/botocore/data/endpoints.json
2019-01-09 14:19:29 Event choose-service-name: calling handler <function handle_service_name_alias at 0x7f6181c3a8c0>
2019-01-09 14:19:29 Loading JSON file: /home/israel/lambda/AWS-AppSync-Lambda-GraphQL-API/venv/local/lib/python2.7/site-packages/botocore/data/serverlessrepo/2017-09-08/service-2.json
2019-01-09 14:19:29 Event creating-client-class.serverlessapplicationrepository: calling handler <function add_generate_presigned_url at 0x7f6181c64230>
2019-01-09 14:19:29 The s3 config key is not a dictionary type, ignoring its value of: None
2019-01-09 14:19:29 Setting serverlessrepo timeout as (60, 60)
2019-01-09 14:19:29 Loading JSON file: /home/israel/lambda/AWS-AppSync-Lambda-GraphQL-API/venv/local/lib/python2.7/site-packages/botocore/data/_retry.json
2019-01-09 14:19:29 Registering retry handlers for service: serverlessrepo
2019-01-09 14:19:29 No Parameters detected in the template
2019-01-09 14:19:29 2 resources found in the template
2019-01-09 14:19:29 Found Serverless function with name='HelloWorldFunction' and CodeUri='hello-world/'
2019-01-09 14:19:29 Trying paths: ['/home/israel/.docker/config.json', '/home/israel/.dockercfg']
2019-01-09 14:19:29 No config file found
2019-01-09 14:19:29 Trying paths: ['/home/israel/.docker/config.json', '/home/israel/.dockercfg']
2019-01-09 14:19:29 No config file found
2019-01-09 14:19:29 Docker is not reachable
Traceback (most recent call last):
File "/home/israel/lambda/AWS-AppSync-Lambda-GraphQL-API/venv/local/lib/python2.7/site-packages/samcli/local/docker/manager.py", line 50, in is_docker_reachable
self.docker_client.ping()
File "/home/israel/lambda/AWS-AppSync-Lambda-GraphQL-API/venv/local/lib/python2.7/site-packages/docker/client.py", line 187, in ping
return self.api.ping(*args, **kwargs)
File "/home/israel/lambda/AWS-AppSync-Lambda-GraphQL-API/venv/local/lib/python2.7/site-packages/docker/api/daemon.py", line 166, in ping
return self._result(self._get(self._url('/_ping'))) == 'OK'
File "/home/israel/lambda/AWS-AppSync-Lambda-GraphQL-API/venv/local/lib/python2.7/site-packages/docker/utils/decorators.py", line 46, in inner
return f(self, *args, **kwargs)
File "/home/israel/lambda/AWS-AppSync-Lambda-GraphQL-API/venv/local/lib/python2.7/site-packages/docker/api/client.py", line 215, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/home/israel/lambda/AWS-AppSync-Lambda-GraphQL-API/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 546, in get
return self.request('GET', url, **kwargs)
File "/home/israel/lambda/AWS-AppSync-Lambda-GraphQL-API/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/home/israel/lambda/AWS-AppSync-Lambda-GraphQL-API/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/home/israel/lambda/AWS-AppSync-Lambda-GraphQL-API/venv/local/lib/python2.7/site-packages/requests/adapters.py", line 498, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(13, 'Permission denied'))
Error: Running AWS SAM projects locally requires Docker. Have you got it installed?
Note: I’m running it in a virtual environment using Python 2.7.12
Expected result
Normal function execution
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: Ubuntu 16.04 LTS
sam --version
: 0.10.0
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 27 (6 by maintainers)
lol… It’s okay. I read that over and got it. I’m sorry for misunderstanding you.
It worked after restarting my system. Thank you so much @DevOpsChris Once again, forgive me for misunderstanding. Enjoy the rest of your day.
Thanks, @fusion27 now i got the success to run sam api with the help of your first message
OS > Ubuntu 16.04 SAM version -> SAM CLI, version 1.15.0 Docker version -> Docker version 20.10.2, build 2291f61
Thank you so much again 😃
Looks like the key piece is this:
ConnectionError: ('Connection aborted.', error(13, 'Permission denied'))
. Docker saying the user needs access to the docker group. What is weird is that you can run docker from the command line. Did you follow https://docs.docker.com/install/linux/linux-postinstall/ when installing docker?My Conditions
Docker version 19.03.13, build 4484c46d9d
sam local invoke HelloWorldFunction -e events/event.json
, yielded the followingWhat Worked
Rebooting after sam-cli installation helped me too. Maybe this could be added to the installation manual. ☺️
Oh that got lost in translation. I’m sorry.
“Stupid question”, was describing “have you rebooted the machine?” It’s a way of asking a question without assumptions, even if it does sound silly. Meaning: My question was stupid, not yours.
It was not to describe your question for this issue that you started.
Not having a tech work easily is frustrating. Hope this helps!
It’s something to do with your docker service on ubuntu, not with aws sam.
Stupid question, have you rebooted the machine? Sometimes it works for me when I log out of my user to ensure ALL user stuff is logged out.