问题:运行 docker run -d --name=telegraf -v /root/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf -v /var/run:/var/run telegraf
报错:docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/root/telegraf/telegraf.conf\\\" to rootfs \\\"/var/lib/docker/overlay2/8602af3643737f7750e6f053910f3f66b5a41540dd84bf2df1c4e1f369a5d37f/merged\\\" at \\\"/var/lib/docker/overlay2/8602af3643737f7750e6f053910f3f66b5a41540dd84bf2df1c4e1f369a5d37f/merged/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.
调查误区:container_linux.go:346,process_linux.go:449,rootfs_linux.go:58
调查区域:caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file
深入问题:docker 命令参数使用详细,确定 -v 使用方法为 -v 本地地址:Docker地址,因根据自己环境修改本地地址,而不是原网上的地址,修改后问题得以解决。