Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 953
Wouter de Kort Avatar asked Jan 22 '18 11:01

Wouter de Kort


2 Answers

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.
like image 74
TomCZ Avatar answered Sep 28 '22 03:09

TomCZ


i got same error happened to me. as below picture, uncheck "Use Docker Compose V2" and it works for me. I wanted to share in case this might be the solution for somebody

enter image description here

like image 27
tiakham Avatar answered Sep 28 '22 03:09

tiakham