Answers: <p>Varnish is monitored with what they call VSM. It's a file in your container. If you bind mount the folder where the files is, you can share the same folder / files in other containers that will be able to read it, and thus will be able to monitor your varnish instance.
  See the note about <a href="https://varnish-cache.org/docs/trunk/reference/vsm.html#vsm-and-containers" rel="nofollow noreferrer">VSM and containers</a> in varnish docs.
  I have been able to launch a <code>varnishstat</code> with statistics in a container with varnish in the image, but no varnish running, like this:</p>
  
  <pre><code>docker run --rm -it \
         --entrypoint=/bin/sh \
         -v /var/lib/docker/overlay2/$hash/merged/usr/local/var/varnish/$hostname:/varnish \
        emgag/varnish:5.1.3 varnishstat -N /varnish/_.vsm
  </code></pre>
  
Answers: CC BY-SA 3.0
Answers: 2017-10-27T15:12:11.313Z
Answers: 2017-10-27T15:30:52.900Z
Answers: 2017-10-27T15:30:52.900Z
Answers: smaftoul
Body: <p>How do you monitor varnish cache inside a docker container? </p>
  
  <p>I have found many tools on Google relating to this but we are focusing only on <code>nagios</code> and <code>new relic</code>.</p>
  
Tags: <docker><containers><nagios>
Title: How do you monitor varnish cache inside a docker container?
UserDisplayName: Nandaraj Ks
ThreadText: # How do you monitor varnish cache inside a docker container?
  
  (Asked by: username_0 on 2017-10-24)
  
  How do you monitor varnish cache inside a docker container?
  
  I have found many tools on Google relating to this but we are focusing only on `nagios` and `new relic`.
  
  **Tags:** docker, containers, nagios
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-10-27. Score: 2
  
  Varnish is monitored with what they call VSM. It's a file in your container. If you bind mount the folder where the files is, you can share the same folder / files in other containers that will be able to read it, and thus will be able to monitor your varnish instance.
  See the note about [VSM and containers](https://varnish-cache.org/docs/trunk/reference/vsm.html#vsm-and-containers) in varnish docs.
  I have been able to launch a `varnishstat` with statistics in a container with varnish in the image, but no varnish running, like this:
  
  ```
  docker run --rm -it \
         --entrypoint=/bin/sh \
         -v /var/lib/docker/overlay2/$hash/merged/usr/local/var/varnish/$hostname:/varnish \
        emgag/varnish:5.1.3 varnishstat -N /varnish/_.vsm
  
  ```
  
  
  ---
  
  