title: Error opening query log file" file=/prometheus/queries.active err="open /prometheus/queries.active: permission denied
body: <p>Trying to run prometheus with a non-root user and after trying the many suggestions from <a href="https://github.com/prometheus/prometheus/issues/5976" rel="nofollow noreferrer">https://github.com/prometheus/prometheus/issues/5976</a>, it just doesn't work for me and I get:</p>
  <pre><code>level=error ts=xxxxxxxx caller=query_logger.go:87 component=activeQueryTracker msg=&quot;Error opening query log file&quot; file=/prometheus/queries.active err=&quot;open /prometheus/queries.active: permission denied&quot;
  level=error ts=xxxxxxx caller=query_logger.go:87 component=activeQueryTracker msg=&quot;Error opening query log file&quot; file=/prometheus/queries.active err=&quot;open /prometheus/queries.active: permission denied&quot;
      
  panic: Unable to create mmap-ed active query log
      panic: Unable to create mmap-ed active query log
  </code></pre>
  <p>Below is my Dockerfile:</p>
  <pre><code>FROM &lt;xxxx&gt;
  
  ARG PROMETHEUS_VERSION=2.17.2
  
  # Dependencies
  RUN apk add --update --no-cache \
      ruby=~2 \
      curl=~7
  
  # Download prometheus
  RUN curl -k -LSs --output /tmp/prometheus.tar.gz \
      https://github.com/prometheus/prometheus/releases/download/v${PROMETHEUS_VERSION}/prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz &amp;&amp; \
      tar -C /tmp --strip-components=1 -zoxf /tmp/prometheus.tar.gz &amp;&amp; \
      rm -f /tmp/prometheus.tar.gz &amp;&amp; \
      mkdir -p /usr/share/prometheus &amp;&amp; \
      mv /tmp/prometheus /bin/ &amp;&amp; \
      mv /tmp/promtool /bin/ &amp;&amp; \
      mv /tmp/consoles /usr/share/prometheus/consoles &amp;&amp; \
      mv /tmp/console_libraries /usr/share/prometheus/console_libraries
  
  # Adding config file
  COPY config/ /etc/prometheus/config
  
  # Adding Alert rule config file
  COPY rules/ /etc/prometheus/rules
  
  # Giving access to unpriviliged user to access prometheus configs
  RUN ln -s /usr/share/prometheus/consoles /usr/share/prometheus/console_libraries /etc/prometheus/ &amp;&amp; \
      mkdir -p /prometheus &amp;&amp; \
      chown -R user:user /etc/prometheus &amp;&amp; \
      chmod -R a+rwx /prometheus
  
  # Adding custom entrypoint
  COPY entrypoint.rb /entrypoint.rb
  
  # Using unprivileged user
  USER user
  
  # Expose prometheus port
  EXPOSE 9090
  
  # Data volume
  VOLUME [ &quot;/prometheus&quot; ]
  
  # Working from data dir
  WORKDIR /prometheus
  
  # Set custom entrypoint
  ENTRYPOINT [ &quot;/entrypoint.rb&quot; ]
  
  # Override default CMD
  CMD [ \
      &quot;--storage.tsdb.path=/prometheus&quot;, \
      &quot;--web.console.libraries=/usr/share/prometheus/console_libraries&quot;, \
      &quot;--web.console.templates=/usr/share/prometheus/consoles&quot; \
  ]
  </code></pre>
  <p>Has anyone faced this before or can spot where the potential issue might be?</p>