Datadog is a monitoring service for cloud–scale applications. It provides monitoring of servers, databases, tools, and services through a SaaS–based data analytics platform.
Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. By doing this, the application will always run the same, regardless of the environment it is running in. Therefore, the container concept is an interesting solution to deploy applications.
How to setup datadog for docker ?
To setup datadog for docker, you need to first install the datadog agent on your host machine. You can find instructions on how to do this in the datadog documentation.
Once the agent is installed, you need to create a docker–compose.yml file in the root of your project. This file will tell docker how to build and run your containers.
In the docker–compose.yml file, you will need to add the following:
version: "3.2" services: datadog-agent: image: gcr.io/datadoghq/agent:7 container_name: datadog-agent environment: - DD_API_KEY=yourKey - DD_SITE=datadoghq.eu - DD_APM_ENABLED=false - DD_APM_NON_LOCAL_TRAFFIC=false - DD_LOGS_ENABLED=true - DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true - DD_LOGS_CONFIG_DOCKER_CONTAINER_USE_FILE=true - DD_CONTAINER_EXCLUDE=name:datadog-agent - DD_PROCESS_AGENT_ENABLED=false volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - /var/lib/docker/containers:/var/lib/docker/containers:ro - /proc/:/host/proc/:ro - /opt/datadog-agent/run:/opt/datadog-agent/run:rw - /sys/fs/cgroup/:/host/sys/fs/cgroup:ro www-garygitton-fr: container_name: www-garygitton-fr image: wordpress:5.6 restart: always labels: - "com.datadoghq.tags.service=www-garygitton-fr" - "com.datadoghq.tags.env=production" - "com.datadoghq.tags.version=5.6" environment: DD_SERVICE: www-garygitton-fr DD_ENV: production DD_VERSION: 5.6 DD_AGENT_HOST: datadog-agent DD_TRACE_AGENT_PORT: 8126