简体   繁体   English

Mac OS 版本上的 AWS SAM CLI 不起作用 - 找不到 docker

[英]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.

相关问题 Python 没有为 aws sam cli 配置 - Python is not configured for aws sam cli 如何强制 AWS SAM CLI 检测更改? - How to force AWS SAM CLI to detect changes? 是否可以使用 SAM cli 发布 aws lambda 的新版本 - Is it possible to publish a new version for aws lambda using SAM cli 使用 sam init 部署 AWS Lambda“Hello World”,sam build sam deploy defaults 失败,无法为 sam-app 创建变更集 - Deploying AWS Lambda "Hello World" using sam init, sam build sam deploy defaults fails with Failed to create changeset for sam-app AWS SAM 构建失败 NpmExecutionError 代码 255 - AWS SAM build failing NpmExecutionError code 255 使用SAM时AWS sam build和sam package有什么区别? - What's the difference between AWS sam build and sam package when using SAM? AWS-Amplify-cli 无法在 Mac 上安装 - AWS-Amplify-cli fails to install on Mac --docker 构建命令的目标选项在 aws codeBuild 中不起作用 - --target option of docker build command doesn't work in aws codeBuild 使用 CLI 在 AWS 中构建一个 docker 图像 - building a docker image in AWS with CLI 使用 aws sam cli 构建和部署 lambda function 后,我在日志中看到 Client.network socket disconnected - After building and deploying lambda function with aws sam cli, I get Client network socket disconnected in logs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM