Hi, just to preface this with the fact that I am a completely new to docker and docker desktop.
I have successfully got a HiveMQ and InfluxDB containers running in docker desktop and I would like to add Telegraf, I made a pull on the latest but when I try to run the container I get the following errors.
Hi, have you mounted the volume?
telegraf’s config file originally located /etc/telegraf.
So if you mount /etc/telegraf to some directory, this directory should have telegraf.conf before run telegraf container.
Look for config sample, brew one, name it telegraf.conf, and place in the directory where you mounted /etc/telegraf.
If you have config file already, check if it has [[outputs.influxdb]] plugin. this plugin directs telegraf where to find your influxdb.
No, getting the same launch error with a freshly installed 1.34.1 via Homebrew. Neither the Homebrew config nor a freshly generated one with telegraf config are able to parse.
Same behavior with the official Docker telegraf image.
By the way, the cookie notice on this forum obscures the Reply button.
I’d be happy to help you get Telegraf running in Docker Desktop! This is a common issue for Docker beginners, and it’s related to how configuration files work with Docker containers.
The error you’re seeing indicates that Telegraf can’t find a valid configuration file at /etc/telegraf/telegraf.conf within the container.
Here’s how you can fix this:
You need to create a Telegraf configuration file on your host machine
Then mount this file into the container at the expected location
Let me walk you through the steps:
First, create a basic Telegraf configuration file on your machine. You can create a file named telegraf.conf with basic settings.
Then, run the Telegraf container with a volume mount that connects your local config file to the expected location in the container.
Here’s a complete command you can try:
# Create a directory for your config
mkdir -p ~/telegraf-config
# Download a sample config to start with
docker run --rm telegraf telegraf config > ~/telegraf-config/telegraf.conf
# Now run the container with the config mounted
docker run -d --name telegraf \
-v ~/telegraf-config/telegraf.conf:/etc/telegraf/telegraf.conf:ro \
telegraf
The key part is the -v flag which creates a volume mapping from your local file to the expected location inside the container.
If you’ve already pulled the Telegraf image using Docker Desktop’s interface, you can also:
Go to Docker Desktop
Find the Telegraf image
Click “Run”
In the “Optional settings”, add a volume binding:
Host path: The full path to your config file
Container path: /etc/telegraf/telegraf.conf
Read only: Check this box
Let me know if this works for you or if you need more specific guidance!