This is applicable to Docker Compose and Swarm. This is also connected to support ticket 129543
I have created a replicable Compose testcase here -https://github.com/sandys/datadog-test . This uses a simple containerized python application https://github.com/sandys/datadog-test/blob/master/gunicorn-flask/app/hello.py
This is how I run the python application - https://github.com/sandys/datadog-test/blob/master/gunicorn-flask/Dockerfile#L22
You can also see the various other things I tried there.
This is my compose file - https://github.com/sandys/datadog-test/blob/master/docker-compose.yml