# Docker DNS Issue?

**URL:** https://forums.losant.com/t/docker-dns-issue/4970
**Category:** Help
**Tags:** edge
**Created:** [March 10, 2023, 8:54pm UTC](https://forums.losant.com/t/docker-dns-issue/4970 "2023-03-10T20:54:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ChrisGM](https://avatars.discourse-cdn.com/v4/letter/c/51bf81/32.png) [@ChrisGM](https://forums.losant.com/u/ChrisGM)
#### Post date: [March 10, 2023, 8:54pm UTC](https://forums.losant.com/t/docker-dns-issue/4970/1 "2023-03-10T20:54:57Z")

</div>

I’ve got an edge-agent running on docker on a new gateway.  
Connected to Losant OK 1st time.

Power cycle the gateway, Docker and the agent boots up OK, however it can no longer connect to Losant broker.

Could it perhaps be related to DNS. (Online forums searching)

Or, related to me having configured using environment variables? (Would you advise using a configuration file?)

Docker Logs:

```auto
2023-03-10T20:34:58.686Z [info] Agent Starting...
2023-03-10T20:34:58.696Z [info] Agent Version: 1.37.0
2023-03-10T20:34:58.781Z [warn] Unable to load flows from disk. Workflow path: /data/workflows must be a directory
2023-03-10T20:34:59.291Z [info] Webserver started on port: 8080
2023-03-10T20:34:59.295Z [info] Local broker not enabled, not starting
2023-03-10T20:34:59.305Z [info] Workflows initialized and running...
2023-03-10T20:34:59.308Z [info] Connecting to: mqtts://broker.losant.com ...
2023-03-10T20:35:19.674Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2023-03-10T20:35:19.681Z [warn] MQTT client disconnected.
2023-03-10T20:35:36.373Z [info] Attempting to reconnect to mqtts://broker.losant.com...
2023-03-10T20:35:56.396Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2023-03-10T20:36:13.089Z [info] Attempting to reconnect to mqtts://broker.losant.com...
2023-03-10T20:36:33.112Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2023-03-10T20:36:49.805Z [info] Attempting to reconnect to mqtts://broker.losant.com...
2023-03-10T20:37:09.826Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2023-03-10T20:37:26.520Z [info] Attempting to reconnect to mqtts://broker.losant.com...
2023-03-10T20:37:46.546Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2023-03-10T20:38:03.243Z [info] Attempting to reconnect to mqtts://broker.losant.com...
2023-03-10T20:38:23.270Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2023-03-10T20:38:39.964Z [info] Attempting to reconnect to mqtts://broker.losant.com...
2023-03-10T20:38:59.992Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2023-03-10T20:39:16.685Z [info] Attempting to reconnect to mqtts://broker.losant.com...
2023-03-10T20:39:36.709Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2023-03-10T20:39:53.402Z [info] Attempting to reconnect to mqtts://broker.losant.com...
2023-03-10T20:40:13.427Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2023-03-10T20:40:30.121Z [info] Attempting to reconnect to mqtts://broker.losant.com...
2023-03-10T20:40:50.145Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2023-03-10T20:41:06.838Z [info] Attempting to reconnect to mqtts://broker.losant.com...
2023-03-10T20:41:26.868Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2023-03-10T20:41:43.561Z [info] Attempting to reconnect to mqtts://broker.losant.com...
2023-03-10T20:42:03.578Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2023-03-10T20:42:20.270Z [info] Attempting to reconnect to mqtts://broker.losant.com...
2023-03-10T20:42:40.297Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2023-03-10T20:42:56.989Z [info] Attempting to reconnect to mqtts://broker.losant.com...
2023-03-10T20:43:17.016Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
error from daemon in stream: Error grabbing logs: invalid character '\x00' looking for beginning of value

```

---

<div class="post-metadata">

### Author: ![ChrisGM](https://avatars.discourse-cdn.com/v4/letter/c/51bf81/32.png) [@ChrisGM](https://forums.losant.com/u/ChrisGM)
#### Post date: [March 10, 2023, 9:16pm UTC](https://forums.losant.com/t/docker-dns-issue/4970/2 "2023-03-10T21:16:31Z")

</div>

stopping, removing the container, then re-creating, did not work.

sudo service docker restart - this did work. However is obviously not the solution

---

<div class="post-metadata">

### Author: ![Sebastian\_Turner](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/sebastian_turner/32/4024_2.png) [@Sebastian\_Turner](https://forums.losant.com/u/Sebastian_Turner)
#### Post date: [March 13, 2023, 4:09pm UTC](https://forums.losant.com/t/docker-dns-issue/4970/3 "2023-03-13T16:09:02Z")

</div>

Hi @ChrisGM !

[`EAI_AGAIN`](https://www.codingdefined.com/2015/06/nodejs-error-errno-eaiagain.html) corresponds to a temporary failure in name resolution, which indicates a problem with reaching the DNS server, or the DNS server responding with an error. These are Docker / network issues outside of the Edge Agent.

Since restarting the Docker service resolved the issue, it might be that the network changed on the host system since the container started. See [this thread](https://stackoverflow.com/a/61955468) for more information and potential solutions.

---

<div class="post-metadata">

### Author: ![ChrisGM](https://avatars.discourse-cdn.com/v4/letter/c/51bf81/32.png) [@ChrisGM](https://forums.losant.com/u/ChrisGM)
#### Post date: [March 30, 2023, 12:49pm UTC](https://forums.losant.com/t/docker-dns-issue/4970/4 "2023-03-30T12:49:50Z")

</div>

Thanks, some scripting to restart docker on a delay after startup solves this issue.
