I have a service-A with a task definition task-A that includes multiple container definitions, for example nginx and grafana. How can these containers communicate with each other? The network used is the default bridge network.
I have tried curl grafana:3000, but the container is not able to resolve the name. If I would try the same on my local machine it would work. What am I missing?
Here is my task definition:
resource "aws_ecs_task_definition" "this" {
family = "x"
execution_role_arn = "x"
task_role_arn = "x"
container_definitions = jsonencode(local.task_definition)
}
Container definition excerpt:
locals {
task_definition = [
{
name: "nginx",
image: "nginx:latest",
portMappings: [{
containerPort: 80,
hostPort: 0,
protocol: "tcp"
}],
dependsOn: [{
"containerName": "grafana",
"condition": "START"
}]
},
{
name: "grafana",
image: "grafana/grafana:latest",
portMappings: [{
containerPort : 3000,
hostPort: 0,
protocol: "tcp"
}]
}
]
}