i'm trying to run my docker-compose file in Portainer
https://github.com/youcann/mqttTelegrafInfluxGrafana-dockerCompose
However when creating the stack i get the error:
level=info msg="ERROR: for telegraf Cannot start service telegraf: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:495: container init caused: rootfs_linux.go:60: mounting \"/data/compose/17/telegraf/telegraf.conf\" to rootfs at \"/var/lib/docker/btrfs/subvolumes/ef51fdc129afe44be30016da700c8fe1a0b1267971c48e0e521e1e90de9ce1d3/etc/telegraf/telegraf.conf\" caused: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type"
level=info msg="Encountered errors while bringing up the project."
level=info msg=": exit status 1 (err=failed to deploy a stack: Creating volume \"mystack_influxdb-storage\" with default driver"
level=info msg="Creating mystack_telegraf_1 ... "
level=info msg="Creating mystack_mosquitto_1 ... "
level=info msg="Creating mystack_influxdb_1 ... "
level=info msg="Creating mystack_grafana_1 ... "
level=info msg="\x1b[1A\x1b[2K\rCreating mystack_grafana_1 ... \x1b[32mdone\x1b[0m\r\x1b[1B\x1b[2A\x1b[2K\rCreating mystack_influxdb_1 ... \x1b[32mdone\x1b[0m\r\x1b[2B\x1b[3A\x1b[2K\rCreating mystack_mosquitto_1 ... \x1b[32mdone\x1b[0m\r\x1b[3B\x1b[4A\x1b[2K\rCreating mystack_telegraf_1 ... \x1b[31merror\x1b[0m\r\x1b[4B"
level=info msg="ERROR: for mystack_telegraf_1 Cannot start service telegraf: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:495: container init caused: rootfs_linux.go:60: mounting \"/data/compose/17/telegraf/telegraf.conf\" to rootfs at \"/var/lib/docker/btrfs/subvolumes/ef51fdc129afe44be30016da700c8fe1a0b1267971c48e0e521e1e90de9ce1d3/etc/telegraf/telegraf.conf\" caused: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type"
level=info
level=info msg="ERROR: for telegraf Cannot start service telegraf: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:495: container init caused: rootfs_linux.go:60: mounting \"/data/compose/17/telegraf/telegraf.conf\" to rootfs at \"/var/lib/docker/btrfs/subvolumes/ef51fdc129afe44be30016da700c8fe1a0b1267971c48e0e521e1e90de9ce1d3/etc/telegraf/telegraf.conf\" caused: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type"
level=info msg="Encountered errors while bringing up the project."
So it looks like there is a problem with the volumes.
How can i modify the docker-compose.yml
to fix this?
use an absolute path instead of a relative path so for example instead of
./telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
use/var/lib/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro