Docker compose issue - Telegraf container failing to retrieve remote config

Hi there,

I have a Docker stack Telegraf container that’s supposed to retrieve Telegraf config file from the Influx DB. However, it’s continuously emitting ‘Error running agent: Error loading config file {config file URL}: Retry 3 of 3 failed to retrieve remove config: 401 Unauthorized’

The compose file contains full set of environment variables, including INFLUX_HOST, INFLUX_ORG, INFLUX_BUCKET, INFLUX_TOKEN, and HOST_HOSTNAME

The compose file is used to bring up 3 separate Telegraf containers and two other containers are running fine. It’s the new one I added in that’s having issues.
The only difference between the operating and the new container is the environment variables and the service name.

Is there a solution for this?

If INFLUX_TOKEN is set, then Telegraf’s agent adds that as an HTTP header when retrieving a config. Is that expected in your case?

Issue got resolved by removing the service and recreating it.
The faulty Telegraf config was allowed to run and restart repeatedly over the weekend and it caused problems unknown, preventing it from connecting to the Influx DB