Skip to content

Instantly share code, notes, and snippets.

@pa-re
Last active August 6, 2020 17:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save pa-re/403c93d9cfefe4f63686ede3060b8768 to your computer and use it in GitHub Desktop.
Save pa-re/403c93d9cfefe4f63686ede3060b8768 to your computer and use it in GitHub Desktop.
/etc/systemd/system/docker.cadvisor.service
sudo docker create \
-v /:/rootfs:ro \
-v /var/run:/var/run:rw \
-v /sys:/sys:ro \
-v /var/lib/docker/:/var/lib/docker:ro \
-p 49876:8080 \
--name=cadvisor \
google/cadvisor:latest
sudo echo "[Unit]
Description=CAdvisor container
Requires=docker.service
After=docker.service
[Service]
Restart=always
ExecStart=/usr/bin/docker start -a cadvisor
ExecStop=/usr/bin/docker stop -t 2 cadvisor
[Install]
WantedBy=multi-user.target" > /etc/systemd/system/docker.cadvisor.service
sudo systemctl daemon-reload
sudo systemctl enable docker.cadvisor
sudo systemctl start docker.cadvisor
@sanfx
Copy link

sanfx commented Aug 6, 2020

if we name the service docker.cadvisor.service will this service act as a child of docker service or did you just randomly named it like this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment