类型为“ bind”的挂载配置无效:尝试在Windows的Docker上运行容器时,绑定源路径不存在 [英] Invalid mount config for type "bind": bind source path does not exist when trying to run container on Docker for Windows

查看:757
本文介绍了类型为“ bind”的挂载配置无效:尝试在Windows的Docker上运行容器时,绑定源路径不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 https:// docs上运行Prometheus示例在Windows上使用Docker的.docker.com / engine / admin / prometheus /#use-prometheus 。我正在执行以下命令:

I'm trying to run the Prometheus sample at https://docs.docker.com/engine/admin/prometheus/#use-prometheus using Docker on Windows. I'm executing the following command:

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

错误为:类型为 bind的无效装载配置:绑定源路径不存在

我很确定文件存在( Test-Path 使用PowerShell返回true)。

I'm pretty certain the file exists (Test-Path with PowerShell returns true).

知道我在做什么错吗?

mount type = volume 上运行同一命令会给我以下错误:

Running the same command with mount type = volume gives me the following error:

C:/temp/prometheus.yml包含本地卷名的无效字符,只有 [a-zA-Z0-9] [a-zA-Z0-9 _.-]如果您打算传递主机目录,请使用绝对路径

我正在传递主机目录,而 C:/temp/prometheus.yml 是绝对路径。

I am passing an host directory and "C:/temp/prometheus.yml" is an absolute path.

推荐答案

更改Windows帐户密码后,在Windows上执行此操作。

You may run into this on Windows after you change your Windows account password.


  1. 打开Docker for Windows设置。

  2. 在共享驱动器选项卡上,单击重置凭据...。

  3. 再次共享驱动器。

这篇关于类型为“ bind”的挂载配置无效:尝试在Windows的Docker上运行容器时,绑定源路径不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆