Reputation: 675
I am trying to run an AWS Lambda project locally on Ubuntu. When I run the project with AWS SAM Local it shows me this error: Error: Running AWS SAM projects locally requires Docker. Have you got it installed?
Upvotes: 46
Views: 45807
Reputation: 21
I am in Arch-linux that's how i resolved my error
i reinstall the docker
wget https://download.docker.com/linux/static/stable/x86_64/docker-27.4.0.tgz -qO- | tar xvfz - docker/docker --strip-components=1
mv ./docker /usr/local/bin
and then install using the pacman
sudo pacman -S docker
then enable it
sudo systemctl enable docker
To avoid using sudo for Docker commands, add your user to the docker group
sudo usermod -aG docker $USER
Then reboot
sudo reboot
Upvotes: 0
Reputation: 21
Having same issue when working with Docker on macOS ($sam local start-api). But after change setting [Allow the default Docker socket to be used(required password)] in the "Advanced" menu in the desktop, It worked.
Upvotes: 2
Reputation: 41
Go to Docker Desktop, then Settings/Advanced and if the "Allow the default Docker socket to be used (requires password)" option is checked, uncheck it, press "Apply & Restart" button and then check this option again and press "Apply & Restart" button again. It will install /var/run/docker.sock
Upvotes: 3
Reputation: 8977
This solved it for me on Mac:
Upvotes: 39
Reputation: 31
For those with Macs and using colima for docker, check two things:
~/.zshrc or ~/.bashrc have DOCKER_HOST pointed to unix://$HOME/.colima/docker.sock"
, like export DOCKER_HOST="unix://$HOME/.colima/docker.sock"
Make sure colima is actually running. colima start
Upvotes: 1
Reputation: 16025
I am using colima for docker on mac with intel chip. and faced this error. was able to resolve it by adding DOCKER_HOST
in .zshrc
file
vi ~/.zshrc
paste export DOCKER_HOST="unix://$HOME/.colima/docker.sock"
in the .zshrc file
escape
:wq
Upvotes: 12
Reputation: 1072
Another cause for this is this recent issue within Docker for Mac.
A quick workaround, as specified in the issue itself, is to run SAM with:
$ DOCKER_HOST=unix://$HOME/.docker/run/docker.sock sam local start-api
You don't need to run SAM as root
.
Upvotes: 41
Reputation: 1285
This error mostly arises due to lack of admin privilege to use docker. Just add sudo to your command. This will work.
eg: sudo sam local start-api --region eu-west-3
Upvotes: 4
Reputation: 4957
If you want to run local sam-cli
, you have first install docker from docker official website then run sudo sam local start-api
. Note that sudo is necessary for running local developer with needed privileges.
Upvotes: 10
Reputation: 91
We are working on Mac and were seeing same message when using an older version of Docker (1.12.6). Have since updated to a newer (but not latest) version 17.12.0-ce-mac49 and it is now fine.
Upvotes: 2
Reputation: 251
I had trouble installing it on Fedora.
When I followed the Docker postinstall instructions I managed to get past this issue.
https://docs.docker.com/install/linux/linux-postinstall/
I had to:
I was then able to run the command:
sam local start-api
Upvotes: 15