简体   繁体   English

在 AWS ECS 上部署 Docker 镜像

[英]Deploy Docker Image on AWS ECS

I am trying to deploy a ECS cluster for browserless.我正在尝试为无浏览器部署 ECS 集群。 However running into some issue which I cant solve.但是遇到了一些我无法解决的问题。

I will try to run you through what I did in the set up.我将尝试让您了解我在设置中所做的事情。

Went into ECS, create cluster, chose custom image, image path is docker.io/browserless/chrome:latest for https://hub.docker.com/r/browserless/chrome/进入 ECS,创建集群,选择自定义镜像,镜像路径是 docker.io/browserless/chrome:latest for https://hub.docker.com/r/browserless/chrome/

Added port 80 and 8080 to port mapping.在端口映射中添加了端口 80 和 8080。

Left everything on default/empty.将所有内容保留为默认/空。

Ran the set up and everything is green and running after a while.运行设置,一段时间后一切都变绿并运行。

Trying to hit the public ip with no success (White Screen)尝试访问公共 ip 没有成功(白屏)

I check cloud watch I see this error我检查云手表我看到这个错误

       /bin/sh: 1: cannot create 
      /usr/local/apache2/htdocs/index.html: Directory nonexistent

Not sure how to fix it.不知道如何修复它。

Thanks谢谢

After playing around it for a while, I fixed the issue. 玩了一段时间后,我解决了这个问题。

As the docker container is running on port 3000, I needed to add 3000 to the security group and hit the public ip with port 3000. 由于Docker容器在端口3000上运行,因此我需要将3000添加到安全组并使用端口3000来访问公共IP。

You might be running into some permission issue inside the container where it tries to create the index.html but fails due to insufficient permissions, you might try doing a CHMOD 755 over the directory , the other way to debug would be to run the docker locally and see if you end up with same issue, then you can add the CHMOD (if thats the issue) to your dockerfile to build the new image. 您可能会在尝试创建index.html的容器内遇到权限问题,但由于权限不足而失败,您可以尝试对目录执行CHMOD 755,另一种调试方法是在本地运行docker并查看是否遇到相同的问题,然后可以将CHMOD(如果是这样)添加到您的dockerfile中以构建新映像。 Hope this gives you some direction 希望这给你一些方向

此错误的主要原因可能是容器定义中的默认命令,创建一个新的任务定义和容器定义设置,导航到环境部分并检查命令,如果该字段中有任何默认命令,请删除/更新它。

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

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