Docker DNS Issue?

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:

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

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

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

Hi @ChrisGM !

EAI_AGAIN 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 for more information and potential solutions.

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