DataDog / docker-compose-example

## Auto-archived due to inactivity. ## A working example of using Docker Compose with Datadog
MIT License
122 stars 202 forks source link

Datadog docker compose file format version 2 error #2

Closed andrewshvv closed 7 years ago

andrewshvv commented 8 years ago

Hi! I got this error when I have tried to change the format of docker compose file to the second version. Do you have an example of datadog docker-compose.yml for newer format?

➜  docker-compose-example docker exec dockercomposeexample_datadog_1 cat /var/log/datadog/dogstatsd.log
2016-03-20 19:39:59 UTC | INFO | dd.dogstatsd | utils.pidfile(pidfile.py:31) | Pid file is: /opt/datadog-agent/run/dogstatsd.pid
2016-03-20 19:39:59 UTC | INFO | dd.dogstatsd | daemon(daemon.py:157) | Starting
2016-03-20 19:39:59 UTC | INFO | dd.dogstatsd | daemon(daemon.py:171) | Pidfile: /opt/datadog-agent/run/dogstatsd.pid
2016-03-20 19:39:59 UTC | INFO | dd.dogstatsd | dogstatsd(dogstatsd.py:329) | Listening on host & port: ('', 8125)
2016-03-20 19:39:59 UTC | INFO | dd.dogstatsd | dogstatsd(dogstatsd.py:160) | Reporting to http://localhost:17123 every 10s
2016-03-20 19:40:09 UTC | INFO | dd.dogstatsd | dogstatsd(dogstatsd.py:205) | Flush #1: flushed 0 metrics, 0 events, and 0 service check runs
2016-03-20 19:40:24 UTC | ERROR | dd.dogstatsd | dogstatsd(dogstatsd.py:269) | Unable to post payload.
Traceback (most recent call last):
  File "/opt/datadog-agent/agent/dogstatsd.py", line 259, in submit_http
    r = requests.post(url, data=data, timeout=5, headers=headers)
  File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/requests/api.py", line 107, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/requests/api.py", line 53, in request
    return session.request(method=method, url=url, **kwargs)
  File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/opt/datadog-agent/embedded/lib/python2.7/site-packages/requests/adapters.py", line 449, in send
    raise ReadTimeout(e, request=request)
ReadTimeout: HTTPConnectionPool(host='localhost', port=17123): Read timed out. (read timeout=5)
2016-03-20 19:40:24 UTC | INFO | dd.dogstatsd | dogstatsd(dogstatsd.py:205) | Flush #2: flushed 1 metric, 0 events, and 0 service check runs

docker-compose.yml example

version: "2"
services:
  web:
    build: web
    command: python app.py
    ports:
     - "5000:5000"
    volumes:
     - ./web:/code
    links:
     - redis
  redis:
    image: redis
  datadog:
    build: datadog
    links:
     - redis
    environment:
     - API_KEY=__your_datadog_api_key_here__
    volumes:
     - /var/run/docker.sock:/var/run/docker.sock
     - /proc/mounts:/host/proc/mounts:ro
     - /sys/fs/cgroup:/host/sys/fs/cgroup:ro
andrewshvv commented 8 years ago

I have solved it by adding network_mode: 'bridge' in all services but I am not sure that it is right solution.

jyee commented 7 years ago

Thanks @AndrewSamokhvalov. I just updated the README to compose v2 format. I wasn't able to replicate the issue (maybe it's been resolved in Compose), but I'm going to leave this issue open in case others encounter it.