Inputs.docker section in telegraf.conf , throwing errors, when uncommented

Bug report

Trying to collect docker container metrics using Grafana-Influxdb-Telegraf on Windows 10, but Telegraf throws error

Relevant telegraf.conf: DOCKER INPUT PLUGIN telegraf.conf -

[[inputs.docker]]
#   ## Docker Endpoint
#   ##   To use TCP, set endpoint = "tcp://[ip]:[port]"
#   ##   To use environment variables (ie, docker-machine), set endpoint = "ENV"
#   endpoint = "unix:///var/run/docker.sock"
    endpoint = "localhost:2375"
#
#   ## Only collect metrics for these containers, collect all if empty
container_names = []
#
#   ## Containers to include and exclude. Globs accepted.
#   ## Note that an empty array for both will include all containers
container_name_include = []
container_name_exclude = []
#
#   ## Timeout for docker list, info, and stats commands
timeout = "5s"

System info:

Windows-10-Pro-64-bit
docker CE 17.x
Using telegraf Repo-official (v1.3)
InfluxDB - official Repo

Steps to reproduce:

  1. Uncommented inputs.docker to timeout, as mentioned above
  2. copied telegraf.conf from host to container.
  3. Error 1 : influxdb on localhost:8086 not recognized, by telegraf container
    Log : Database creation failed: Post http://localhost:8086-query?q=CREATE+DATABASE+%22telegraf%22: dial tcp 127.0.0.1:8086: getsockopt: connection refused
  4. Error 2 : 2017/09/29 18:10:25 I! Using config file: /etc/telegraf/telegraf.conf
    2017-09-29T18:10:25Z I! Database creation failed: Post http://localhost:8086-query?q=CREATE+DATABASE+%22telegraf%22: dial tcp 127.0.0.1:8086: getsockopt: connection refused
    2017-09-29T18:10:25Z I! Starting Telegraf v1.4.1
    2017-09-29T18:10:25Z I! Loaded outputs: influxdb
    2017-09-29T18:10:25Z I! Loaded inputs: inputs.kernel inputs.mem inputs.processes inputs.swap inputs.system inputs.cpu inputs.disk inputs.diskio inputs.docker
    2017-09-29T18:10:25Z I! Tags enabled: host=c9a2e52355d4
    2017-09-29T18:10:25Z I! Agent Config: Interval:10s, Quiet:false, Hostname:“c9a2e52355d4”, Flush Interval:10s
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0xb3ec17]

goroutine 28 [running]:
github.com-influxdata/telegraf/plugins/inputs/docker.(*Docker).gatherInfo(0xc042166480, 0x1c8ae00, 0xc0422788c0, 0x0, 0x0)
/home/ubuntu/telegraf-build/src/github.com-influxdata/telegraf/plugins/inputs/docker/docker.go:198 +0x15e
github.com-influxdata/telegraf/plugins/inputs/docker.(*Docker).Gather(0xc042166480, 0x1c8ae00, 0xc0422788c0, 0x0, 0x0)
/home/ubuntu/telegraf-build/src/github.com-influxdata/telegraf/plugins/inputs/docker/docker.go:158 +0x9b
github.com-influxdata/telegraf/agent.gatherWithTimeout.func1(0xc04239e2a0, 0xc04210c9c0, 0xc0422788c0)
/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:153 +0x50
created by github.com-influxdata/telegraf/agent.gatherWithTimeout
/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/agent/agent.go:154 +0xd3

Expected behavior:

All running “Docker Linux containers” on Docker CE(Windows) metrics should be collected by Telegraf

Actual behavior:

Telegraf collects only host information/stats

Additional info: docker commands used

docker cp telegraf:\etc\telegraf\telegraf.conf .\deuce\telegraf.conf
–>cd deuce
docker cp telegraf.conf telegraf:\etc\telegraf\telegraf.conf
docker logs telegraf
docker run -d --net=container:influxdb telegraf

Feature Request

Telegraf.conf file for windows 10 is needed. A readymade file in windows for enabling all container metrics should be supplied. different

Opening a feature request kicks off a discussion.

Proposal:

Current behavior:

Desired behavior:

Use case: [Why is this important (helps with prioritizing requests)]

telegraf.conf.txt

This is a bug, thank you for opening an issue