From a2b5511966de9e784ca993a333cd25a75835014c Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Fri, 11 Nov 2022 13:22:04 +0000 Subject: [PATCH] prometheus: fix startup to create writable persistent volume --- prometheus.yaml | 7 ++++++- prometheus/entrypoint.sh | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 prometheus/entrypoint.sh diff --git a/prometheus.yaml b/prometheus.yaml index c0c95ee..6ce8dce 100644 --- a/prometheus.yaml +++ b/prometheus.yaml @@ -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 diff --git a/prometheus/entrypoint.sh b/prometheus/entrypoint.sh new file mode 100755 index 0000000..fe60e34 --- /dev/null +++ b/prometheus/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh -x + +chmod 777 /prometheus +exec su -s /bin/sh nobody <