简体   繁体   English

如何在 AWS ECS 上访问任务的 apache 容器?

[英]How to access the apache container of a task on AWS ECS?

I am setting up an infrastructure to deploy my application on AWS.我正在设置基础设施以在 AWS 上部署我的应用程序。 I am using ECS service because I am trying to deploy a Docker-based application.我正在使用 ECS 服务,因为我正在尝试部署基于 Docker 的应用程序。 So far I have created a task definition with two containers one for the apache and another one for PHP.到目前为止,我已经创建了一个任务定义,其中包含两个容器,一个用于 apache,另一个用于 PHP。 Then I launched an ECS cluster with an EC2 instance and a task running.然后我启动了一个 ECS 集群,其中有一个 EC2 实例和一个正在运行的任务。 They all seem to be up and running.他们似乎都在运行。 Now, I am trying to figure out how I can access the apache of my EC2 instance with the Cluster on the browser.现在,我想弄清楚如何使用浏览器上的集群访问我的 EC2 实例的 apache。

This is how I created the apache container.这就是我创建 apache 容器的方式。

在此处输入图片说明

在此处输入图片说明

And then I created the php container as follow.然后我按如下方式创建了 php 容器。

在此处输入图片说明

Then I launched an EC2 based ECS cluster with one instance in it.然后我启动了一个基于 EC2 的 ECS 集群,其中有一个实例。 Then I run one task within the cluster.然后我在集群中运行一项任务。 Then I tried to open the public IP address of my instance.然后我尝试打开我的实例的公共 IP 地址。 It just keeps loading loading and loading.它只是不断加载加载和加载。 What is wrong with my configuration?我的配置有什么问题? How can I access it on the browser?如何在浏览器中访问它?

It seems to me there's a couple of possible scenarios here you could check:在我看来,您可以检查以下几种可能的情况:

  • If do you reach the service and are stuck on an endless reloading loop, which might point to something in your code that could be causing it to do that,如果您到达服务并陷入无休止的重新加载循环,这可能指向您的代码中的某些内容可能导致它这样做,

  • If you're having a long wait time till the browser actually gives a timeout, which might be caused by not having the right port open on the Security Group associated with your task definition.如果您在浏览器实际给出超时之前等待很长时间,这可能是由于没有在与您的任务定义关联的安全组上打开正确的端口造成的。

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

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