Invalid mount config for type "bind": bind source path does not exist when trying to run container on Docker for Windows

Wouter de Kort picture Wouter de Kort · Jan 22, 2018 · Viewed 9.5k times · Source

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

The error is: invalid mount config for type "bind": bind source path does not exist

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

Any idea what I'm doing wrong?

Update

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

C:/temp/prometheus.yml" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path"

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

Answer

TomCZ picture TomCZ · Jul 18, 2018

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

  1. Open Docker for Windows Settings.
  2. On Shared Drives tab click Reset credentials...
  3. Share your drive once again.