# APM Server transport error (ECONNREFUSED)

**URL:** <https://discuss.elastic.co/t/apm-server-transport-error-econnrefused/322153>\
**Category:** APM\
**Tags:** nodejs, server\
**Created:** [December 29, 2022, 12:07pm UTC](https://discuss.elastic.co/t/apm-server-transport-error-econnrefused/322153 "2022-12-29T12:07:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmd1](https://avatars.discourse-cdn.com/v4/letter/j/ccd318/32.png) [@jmd1](https://discuss.elastic.co/u/jmd1)\
**Post date:** [December 29, 2022, 12:07pm UTC](https://discuss.elastic.co/t/apm-server-transport-error-econnrefused/322153/1 "2022-12-29T12:07:19Z")

</div>

hello, can you please advise? I have a nodejs app where I need to add an elastic agent. The application is running on a Fargate, What I did is that inside my dockerfile I wrote a script that will install and enroll this agent in this Fargate. I did the same on a POC and was working fine.  
From Kibana it says that it's unhealth although its healthy on ELB. From cloudwatch I am getting ""message": "APM Server transport error (ECONNREFUSED): connect ECONNREFUSED 127.0.0.1:8200" all the needed env variable are added into task definition. On my POC I was having this issue and was able to solve it by installing systemctl in order to restart elastic-agent service. Can you please advise? It is something related to SG?

---

<div class="post-metadata">

**Author:** ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)\
**Post date:** [December 30, 2022, 7:09am UTC](https://discuss.elastic.co/t/apm-server-transport-error-econnrefused/322153/2 "2022-12-30T07:09:20Z")

</div>

Hi @jmd1 ,  
the error indicates that the apm agent tries to connect to the apm-server on localhost - are they running inside the same docker container?

Genereally when running APM Server inside docker, you need to configure it to listen to all interfaces (`0.0.0.0:8200`) instead of localhost - please verify that this is configured properly, otherwise it won't be reachable.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 27, 2023, 7:09am UTC](https://discuss.elastic.co/t/apm-server-transport-error-econnrefused/322153/3 "2023-01-27T07:09:55Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
