[英]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.我正在尝试使用 AWS SAM CLI 运行sam build
,但遇到了问题。 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.貌似docker找不到,虽然安装了。 When I run docker ps
I see the confirmation that Docker is running.当我运行docker ps
时,我看到 Docker 正在运行的确认信息。 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.奇怪的是, build
命令确实适用于我在同一个项目中也使用带有英特尔芯片的 MacOS 的同事。
I have SAM CLI, version 1.60.0
installed我安装了SAM CLI, version 1.60.0
I have Docker version 20.10.20
installed and running我安装并运行了Docker version 20.10.20
I'm running it on MacOS Montery 12.5
我在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.这是由于某些最新版本的 Docker 破坏了 Mac 的兼容性。 Check this bug report .检查此错误报告。 Apparently it has already been fixed in the latest version of Docker for Mac.显然它已经在 Mac 的最新版本 Docker 中得到修复。
In the meantime, the following workaround (as specified in the above GitHub issue) works for me:同时,以下解决方法(如上述 GitHub 问题中所述)适用于我:
DOCKER_HOST=unix://$HOME/.docker/run/docker.sock sam local start-api
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.