简体   繁体   English

AWS App Runner 在健康检查时“创建失败”

[英]AWS App Runner "Create Failed" on health check

I'm creating my first app on AWS App Runner.我正在 AWS App Runner 上创建我的第一个应用程序。 I have a simple nginx Docker image that works locally by serving html on localhost:8080.我有一个简单的 nginx Docker 图像,它通过在 localhost:8080 上提供 html 在本地工作。

When I try to deploy it, the result is "Create Failed".当我尝试部署它时,结果是“创建失败”。 Upon digging into the CloudWatch logs, I see that the health check failed.深入了解 CloudWatch 日志后,我发现健康检查失败了。 The health check is configured to ping the root of the service "/" at port 8080.健康检查配置为在端口 8080 ping 服务“/”的根。

I was able to resolve this by deleting my App Runner app (this is currently the only way to change the configuration-- see this issue), then creating a new one and specifying the health check to ping port 80.我能够通过删除我的 App Runner 应用程序解决这个问题(这是目前更改配置的唯一方法——请参阅问题),然后创建一个新应用程序并指定运行状况检查以 ping 端口 80。

Are you getting this error:您是否收到此错误:

10-21-2021 02:13:32 PM [AppRunner] Health check on port '80' failed. Service is rolling back. Check your configured port number. For more information, read the application logs.
10-21-2021 02:07:40 PM [AppRunner] Performing health check on port '80'.
10-21-2021 02:07:30 PM [AppRunner] Provisioning instances and deploying image.
10-21-2021 02:07:20 PM [AppRunner] Successfully pulled image from ECR.
10-21-2021 02:04:58 PM [AppRunner] Service status is set to OPERATION_IN_PROGRESS.
10-21-2021 02:04:57 PM [AppRunner] Service creation started.

If you are building on an M1 mac by chance?如果您碰巧在 M1 mac 上构建? If so that's probably the reason.如果是这样,那可能就是原因。 The image that's being built is of the ARM architecture, and App Runner or Fargate is an x86 runtime.正在构建的映像属于 ARM 架构,App Runner 或 Fargate 是一个 x86 运行时。

Aws is working on fixing this issue here: #1949 Aws 正在努力解决此问题: #1949

In the meantime, there's a workaround, you can prefix copilot commands with the DOCKER_DEFAULT_PLATFORM=linux/amd64同时,有一个解决方法,您可以在副驾驶命令前加上 DOCKER_DEFAULT_PLATFORM=linux/amd64

For example:例如:

DOCKER_DEFAULT_PLATFORM=linux/amd64 copilot deploy

So basically when you build your docker image just use:所以基本上当你构建你的 docker 图像时,只需使用:

You can use buildx (mobi) which suipport cli for platform.您可以使用支持平台 cli 的 buildx (mobi)。

docker build --platform linux/amd64 -t your-docker-image-name .

Hope that helps, and sorry for the trouble希望有所帮助,抱歉给您带来麻烦

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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