I am trying to run my docker containers on aws ecs using aws-cli (instance-type is EC2)
I have a docker-compose file with 2 services.
version:'3'
services:
service-one:
image: dockerhub/image1
ports:
- "4500:9090"
service-two:
image: dockerhub/image2
ports:
- "80:3030"
When i run this on aws ecs using ecs-cli:
ecs-cli compose service up --config-name config --ecs-profile etc
My containers fire up successfully But ONLY one container (the service-two) shows up on port 80, i cannot see my service-one on port 4500 even though it is running successfully inside docker (docker container ps). I also tried running service-one on port 80 and then it showed up.
Summarizing: i can't discover any container from the web unless it in running on port 80.
Check the security group associated with your EC2 instance and on inbound rules
add a new rule of type http
, as Port range your container port (4500
), as source, just for testing (you are exposing your service to the world), select source Anywhere
.