Search code examples
amazon-web-servicesdockeraws-lambdaaws-sam-cli

AWS Lambda Sam can't find docker


I'm trying to test my hello world lambda function with aws-sam-cli using the following command in my project root folder:

sam local start-api --debug

This gives me the following output in the console:

2018-07-11 16:13:15 local start-api command is called
2018-07-11 16:13:15 2 resources found in the template
2018-07-11 16:13:15 Found Serverless function with name='Hello' and CodeUri='.'
2018-07-11 16:13:15 Trying paths: ['/home/jamiro/.docker/config.json', '/home/jamiro/.dockercfg']
2018-07-11 16:13:15 No config file found
2018-07-11 16:13:15 Trying paths: ['/home/jamiro/.docker/config.json', '/home/jamiro/.dockercfg']
2018-07-11 16:13:15 No config file found
Error: Running AWS SAM projects locally requires Docker. Have you got it installed?

To my understanding, I do have docker installed, as performing docker --version results in the following output:

Docker version 18.03.1-ce, build 9ee9f40

Does anyone one have an idea why sam can't find docker?


Solution

  • Follow these steps:

    1. Delete the ~/.docker directory
    2. Create the "docker" group
    3. Add my user to the "docker" group
    4. Logout and back in again
    5. Restart the "docker" daemon.

    More info in the Docker postinstall instructions