【发布时间】:2018-01-22 11:29:39
【问题描述】:
我正在尝试在 Windows 上使用 Docker 在https://docs.docker.com/engine/admin/prometheus/#use-prometheus 运行 Prometheus 示例。我正在执行以下命令:
docker service create --replicas 1 --name my-prometheus `
--mount type=bind,source="C:/temp/prometheus.yml",destination=/etc/prometheus/prometheus.yml `
--publish published=9090,target=9090,protocol=tcp `
prom/prometheus
错误是:invalid mount config for type "bind": bind source path does not exist
我很确定该文件存在(Test-Path 使用 PowerShell 返回 true)。
知道我做错了什么吗?
更新
使用mount type = volume 运行相同的命令会出现以下错误:
C:/temp/prometheus.yml”包含本地卷名的无效字符,仅允许使用“[a-zA-Z0-9][a-zA-Z0-9_.-]”。如果您打算传递主机目录,请使用绝对路径"
我正在传递一个主机目录,"C:/temp/prometheus.yml" 是一个绝对路径。
【问题讨论】:
-
如果您将挂载类型更改为卷 --mount type=volume。
Mount type=bind should be used on --mount type=bind,source=/path/on/host,destination=/path/in/container -
@RanadipDutta 谢谢 试过了,但还是出错。查看更新后的帖子,
-
你是否与 Docker 共享了 C 盘? docs.docker.com/docker-for-windows/#shared-drives
-
@BMitch 是的,我已经共享了 C 盘。
标签: powershell docker prometheus docker-for-windows