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?
I installed Docker using the GUI with all default presets and I was having the same issue. I fixed this same issue using Docker's dashboard.
Settings -> Advanced -> Allow the default Docker socket to be used (requires password)
By enabling it, it "Creates /var/run/docker.sock which some third-party clients may use to communicate with Docker Desktop"
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.
sam local invoke
, it began building the image. –
Dustpan © 2022 - 2024 — McMap. All rights reserved.
docker
command line is working for you? – Animatism