From 267cd4e95db832bd3ba3a3ed7cb28492c3026c75 Mon Sep 17 00:00:00 2001 From: aramalipoor Date: Sun, 30 Dec 2018 12:28:44 +0330 Subject: [PATCH] Dockerfile: Remove VOLUME instruction This instruction is usually useless e.g. when using novolume-plugin. In cloud environments volumes must be mounted and there's no point in keeping Prometheus data temporary volume dir only during life-time of a container. Another downside of using VOLUME instruction is it hard to undone it in child images and one would need to re-write the Dockerfile. --- Dockerfile | 4 ++-- Dockerfile.rhel | 4 ++-- Dockerfile.rhel7 | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index f0e23988a6c..de01d2bbaf7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,10 +19,10 @@ COPY --from=builder ${FROM_DIRECTORY}/consoles/ /usr RUN ln -s /usr/share/prometheus/console_libraries /usr/share/prometheus/consoles/ /etc/prometheus/ RUN mkdir -p /prometheus && \ - chown -R nobody:nobody etc/prometheus /prometheus + chgrp -R 0 /etc/prometheus /prometheus && \ + chmod -R g=u /etc/prometheus /prometheus USER nobody EXPOSE 9090 -VOLUME [ "/prometheus" ] WORKDIR /etc/prometheus ENTRYPOINT [ "/bin/prometheus" ] diff --git a/Dockerfile.rhel b/Dockerfile.rhel index f132f483c10..9ea5d635068 100644 --- a/Dockerfile.rhel +++ b/Dockerfile.rhel @@ -19,11 +19,11 @@ COPY --from=builder ${FROM_DIRECTORY}/consoles/ /usr RUN ln -s /usr/share/prometheus/console_libraries /usr/share/prometheus/consoles/ /etc/prometheus/ RUN mkdir -p /prometheus && \ - chown -R nobody:nobody etc/prometheus /prometheus + chgrp -R 0 /etc/prometheus /prometheus && \ + chmod -R g=u /etc/prometheus /prometheus USER nobody EXPOSE 9090 -VOLUME [ "/prometheus" ] WORKDIR /prometheus ENTRYPOINT [ "/bin/prometheus" ] CMD [ "--config.file=/etc/prometheus/prometheus.yml", \ diff --git a/Dockerfile.rhel7 b/Dockerfile.rhel7 index 489d2a97deb..b049b8c2b92 100644 --- a/Dockerfile.rhel7 +++ b/Dockerfile.rhel7 @@ -10,11 +10,11 @@ RUN yum install -y prometheus && \ yum clean all RUN ln -s /usr/share/prometheus/console_libraries /usr/share/prometheus/consoles/ /etc/prometheus/ RUN mkdir -p /prometheus && \ - chown -R nobody:nobody etc/prometheus /prometheus + chgrp -R 0 /etc/prometheus /prometheus && \ + chmod -R g=u /etc/prometheus /prometheus USER nobody EXPOSE 9090 -VOLUME [ "/prometheus" ] WORKDIR /prometheus ENTRYPOINT [ "/bin/prometheus" ] CMD [ "--config.file=/etc/prometheus/prometheus.yml", \