问题描述
我是ECS的新手,我正在尝试使用Fargate在ECS任务中部署几个容器.
我有1个正在运行的容器使用Angular2,并且在nginx上运行,另一个容器是后端,并且在Springboot上运行,并使用端口42048.
我将awsvpc网络与Fargate一起使用,我必须这样做.
Angular应用使用localhost:42048/some_url与后端进行通信,并且在我的本地docker中可以正常工作,但是在AWS中,前端找不到后端.目前,我的端口映射为80的前端和42048的后端,而在本地部署时前端能够以localhost:42048的方式找到后端
任何帮助将不胜感激.谢谢
AWSVPC中不允许链接.
当设置为网桥时,您只能在网络模式下进行链接.
链接类型:字符串数组必填:否
Note
This parameter is not supported for Windows containers or tasks using the awsvpc network mode.
Important
Containers that are collocated on a single container instance may be able to communicate with each other without requiring links or host port mappings. Network isolation is achieved on the container instance using security groups and VPC settings.
In network mode, you have to define two containers in the same task definition and then mentioned the name of the container in the link.
And then Mentioned the name of backend container in frontend container.
这篇关于如何链接在AWS ECS任务中运行的2个容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!