docs
docs copied to clipboard
Issue when trying to mount prometheus/prometheus.yaml to /etc/
When I execute this code to install prometheus using docker :
# Create persistent volume for your data
docker volume create prometheus-data
# Start Prometheus container
docker run \
-d \
--name prometheus \
--restart always \
-p 9090:9090 \
-v /prometheus/prometheus.yml:/etc/prometheus/prometheus.yml \
-v prometheus-data:/prometheus \
prom/prometheus
I got the following error:
Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/prometheus/prometheus.yml" to rootfs at "/etc/prometheus/prometheus.yml": create mountpoint for /etc/prometheus/prometheus.yml mount: cannot create subdirectories in "/var/lib/docker/overlay2/2e485672e2ca0e92b67c42514c2d632dfc807ea0d0d2eb1db1da6b5d1b1bed6f/merged/etc/prometheus/prometheus.yml": 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
I've followed this documentation instruction
/prometheus/prometheus.yml exists?
works as expected for me
$docker run -d --rm --name prometheus -p 9090:9090 -v /home/rrackow/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml -v prometheus-data:/prometheus prom/prometheus
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cecfdfcebb08 prom/prometheus "/bin/prometheus --c…" 2 minutes ago Up 2 minutes 0.0.0.0:9090->9090/tcp, [::]:9090->9090/tcp prometheus