I have Docker up and running on my Mac. But "sam local invoke" command results in Error: Running AWS SAM projects locally requires Docker. Have you got it installed and running?
Anyone knows what could be the reason?
I have Docker up and running on my Mac. But "sam local invoke" command results in Error: Running AWS SAM projects locally requires Docker. Have you got it installed and running?
Anyone knows what could be the reason?
There was a change Docker Desktop's default context settings.
On Mac, it may default to desktop-linux
if symlink to /var/run/docker.sock
was not created. This seems to cause problem with SAM CLI (and probably, a lot of other apps) that expects to communicate with Docker using this socket.
The easiest way to fix this is to set DOCKER_HOST
environment variable to point to the socket file associated with desktop-linux
.
Run export DOCKER_HOST="unix://Users/<username>/.docker/run/docker.sock"
(add this to your .zshrc
or .bashrc
file so that you don't have to define the variable every time you start a shell)
and then try running sam command.