Mohan Reddy Guntaka
Mohan Reddy Guntaka

Reputation: 71

Datadog: ERROR:ddtrace.writer:cannot send services to localhost:8126: [Errno 111] Connection refused

My application is running in the docker container and it is not able to communicate with dd-trace agent running on host which is ec2

I've done all the configurations and still facing ERROR:ddtrace.writer:cannot send spans to localhost:8126: [Errno 111] Connection refused

Any idea how to fix this?

Upvotes: 3

Views: 6157

Answers (1)

nickgryg
nickgryg

Reputation: 28713

There are two ways to access dd-trace agent on host from a container:

1. Only on <HOST_IP>:8126, if docker container is started in a bridge network:

docker run -d <image_name>

dd-trace agent should be bound to <HOST_IP> or 0.0.0.0 (which includes <HOST_IP>).

2. On <HOST_IP>:8126 (if dd-trace agent is bound to <HOST_IP> or 0.0.0.0) and localhost:8126, if docker container is started in the host network:

docker run --network host -d <image_name>

As you already try to reach dd-trace agent on localhost:8126, so the second way is the best solution.

Upvotes: 1

Related Questions