prometheus: fix startup to create writable persistent volume

single-dockerfile
Ubuntu 2 years ago
parent 7a0a530add
commit a2b5511966
  1. 7
      prometheus.yaml
  2. 11
      prometheus/entrypoint.sh

@ -2,13 +2,18 @@ version: '3'
services:
prometheus:
image: prom/prometheus
restart: always
container_name: prometheus
user: root
volumes:
- ./data/prometheus/storage:/prometheus
- ./data/prometheus/storage:/prometheus:rw
- ./prometheus/prometheus.yaml:/etc/prometheus/prometheus.yml:ro
- ./prometheus/entrypoint.sh:/entrypoint.sh:ro
entrypoint: ["/entrypoint.sh"]
cadvisor:
image: gcr.io/cadvisor/cadvisor:latest
restart: always
container_name: cadvisor
volumes:
- /:/rootfs:ro

@ -0,0 +1,11 @@
#!/bin/sh -x
chmod 777 /prometheus
exec su -s /bin/sh nobody <<EOF
exec /bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--web.console.libraries=/etc/prometheus/console_libraries \
--web.console.templates=/etc/prometheus/consoles
EOF
# --storage.local.path=/prometheus \
Loading…
Cancel
Save