简体   繁体   中英

AWS SAM CLI on Mac OS build does not work - cannot find docker

I'm trying to run sam build using the AWS SAM CLI, but run into a problem. I get the following error:

Build Failed
Error: Building image for DefaultFunction requires Docker. is Docker running?

It looks like docker cannot be found, although it is installed. When I run docker ps I see the confirmation that Docker is running. The weird thing is that the build command does actually work for my colleagues in the same project who are also using MacOS with Intel chip.

I have SAM CLI, version 1.60.0 installed

I have Docker version 20.10.20 installed and running

I'm running it on MacOS Montery 12.5

I've been looking for a answer to this problem for a while now, but couldn't find a solution. Does anyone know how to fix this? I've followed all steps from this documentation .

This is due to certain recent versions of Docker for Mac breaking compatibility. Check this bug report . Apparently it has already been fixed in the latest version of Docker for Mac.

In the meantime, the following workaround (as specified in the above GitHub issue) works for me:

DOCKER_HOST=unix://$HOME/.docker/run/docker.sock sam local start-api

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM