Portainer Stack vs docker-compose volume creation



我试图在Portainer中运行我的docker-compose文件

https://github.com/youcann/mqttTelegrafInfluxGrafana-dockerCompose

然而,当创建堆栈时,我得到错误:

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[1Ax1b[2KrCreating mystack_grafana_1   ... x1b[32mdonex1b[0mrx1b[1Bx1b[2Ax1b[2KrCreating mystack_influxdb_1  ... x1b[32mdonex1b[0mrx1b[2Bx1b[3Ax1b[2KrCreating mystack_mosquitto_1 ... x1b[32mdonex1b[0mrx1b[3Bx1b[4Ax1b[2KrCreating mystack_telegraf_1  ... x1b[31merrorx1b[0mrx1b[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."

所以看起来体积有问题。我如何修改docker-compose.yml来解决这个问题?

使用绝对路径而不是相对路径例如,代替./telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro使用/var/lib/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro

最新更新