Run docker container as default system services

  1. Start docker daemon when ubuntu launch.
  2. Add conf on service as follow
description "cAdvisor"

start on filesystem and started docker
stop on runlevel [!2345]

#respawn

# @see https://github.com/google/cadvisor/blob/master/docs/running.md#standalone
script

    docker rm -f cadvisor  || true

    docker run  \
        --volume=/:/rootfs:ro          \
        --volume=/var/run:/var/run:rw  \
        --volume=/sys:/sys:ro          \
        --volume=/var/lib/docker/:/var/lib/docker:ro  \
        --publish=8080:8080  \
        --detach=true    \
        --restart=always \
        --name=cadvisor  \
        google/cadvisor:latest

end script

For more detail, check here. Automatically start containers


Buy Me A Coffee

Evan

Attitude is everything