I am total new to Prometheus and Docker and I having issues in configuring Prometheus with my custom yml file. The latter file is stored at "D:\Projects\Msc-Thesis-Project\tmp". Then I am trying to run the following command.
docker run --net=host \
-v /tmp/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus
but I receive the following error
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: >runc create failed: unable to start container process: error during container init: error >mounting "/tmp/prometheus.yml" to rootfs at "/etc/prometheus/prometheus.yml": mount >/tmp/prometheus.yml:/etc/prometheus/prometheus.yml (via /proc/self/fd/6), flags: 0x5000: >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.
Don't know what I am doing wrong. Can you please help me???
CodePudding user response:
It's best advisable to write the absolute path, including the letter of your drive that the file is stored, like this,
docker run --net=host -v /mnt/c/tmp/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
Replace /c/ with the letter of your drive, including the names of folders that go beyond that, until you reach the yml file, to get the absolute path.