我在AWS ECS中定义了任务,如屏幕截图所示:
现在,当我在集群中运行taskdefination时,它可以成功运行,但是容器的状态永远都不会恢复正常。当我尝试在容器内运行相同的命令(healthcheck命令[curl命令])时,我能够在容器内运行相同的命令,然后它成功运行。我也尝试使用CMD代替CMD-SHELL,但是没有任何效果。内部容器apache在端口80上运行。
注意,我通过提交docker容器而不是Dockerfile来制作docker映像。
不了解为何无法进行健康检查。在网上没有发现重大变化。如果以前有人遇到过此问题,请提供帮助。
答案 0 :(得分:3)
您在HEALTHCHECK
部分(双管道)中输入了错误的命令。
我想您想使用CMD-SHELL,curl --fail http://localhost/ || exit 1
而不是...|exit 1|
答案 1 :(得分:0)
删除命令周围的双引号,应该可以使用