Docker -v flag translated to AWS ECS Task Definition
Asked Answered
F

1

1

I'm following the datadog guide here: https://docs.datadoghq.com/database_monitoring/setup_postgres/aurora/?tab=docker

which says to run this docker command:

docker run -e "DD_API_KEY=${DD_API_KEY}" \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  -l com.datadoghq.ad.check_names='["postgres"]' \
  -l com.datadoghq.ad.init_configs='[{}]' \
  -l com.datadoghq.ad.instances='[{
    "dbm": true,
    "host": "<AWS_INSTANCE_ENDPOINT>",
    "port": 5432,
    "username": "datadog",
    "password": "<UNIQUEPASSWORD>"
  }]' \
  gcr.io/datadoghq/agent:${DD_AGENT_VERSION}

That's all well and good, the labels are easy to configure; what's not clear to me is how to set the task definition for the volume (ideally in the console)

I'm not sure how to translate -v /var/run/docker.sock:/var/run/docker.sock:ro into these inputs: ECS Task ECS Container

I currently have this in my Dockerfile (but I think that's only part of the solution - and potentially incorrect):

VOLUME ["/var/run/docker.sock:/var/run/docker.sock:ro"]

Ferraro answered 12/11, 2021 at 15:11 Comment(0)
O
0

That mapping is knowing as mounting the docker socket. Which means you are giving your container access to the docker daemon. Which in turns means it's a big deal. It works and some specific scenarios require that (e.g. a Jenkins container may need that to be able to launch new worker containers on the host). I don't know enough datadog to say what they use this for.

You don't map it inside of the Dockerfile but you are on the right path in terms of where you'd want to map it on the ECS console (see here).

Please note that this setup would not be supported using Fargate (only EC2).

Ornis answered 12/11, 2021 at 18:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.