Pass flag to cAdvisor with docker

Viewed 311

I am running cAdvisor using the following code as instructed here:

sudo docker run \
  --volume=/:/rootfs:ro \
  --volume=/var/run:/var/run:ro \
  --volume=/sys:/sys:ro \
  --volume=/var/lib/docker/:/var/lib/docker:ro \
  --volume=/dev/disk/:/dev/disk:ro \
  --publish=8080:8080 \
  --detach=true \
  --name=cadvisor \
  google/cadvisor:latest

I need to pass the following flag to cAdvisor as suggested in this answer:

--enable_load_reader=true

How do I pass that flag to cAdvisor?

1 Answers

The google/cadvisor container behaves like the binary itself, therefore you can just append the option to the end of the docker run ... command. You would also like to add the --net host option to your docker run command as noted here:

sudo docker run \
  --volume=/:/rootfs:ro \
  --volume=/var/run:/var/run:ro \
  --volume=/sys:/sys:ro \
  --volume=/var/lib/docker/:/var/lib/docker:ro \
  --volume=/dev/disk/:/dev/disk:ro \
  --publish=8080:8080 \
  --detach=true \
  --net host \
  --name=cadvisor \
  google/cadvisor:latest \
    --enable_load_reader=true
Related