Browse Source

new: [docker-host] limit docker logs size

pull/43/head
Valentin Lab 5 months ago
parent
commit
04df6af413
  1. 6
      precise/host/hooks/install.d/60-docker.sh
  2. 19
      precise/host/hooks/install.d/70-0k.sh

6
precise/host/hooks/install.d/60-docker.sh

@ -14,13 +14,17 @@ if [ "$exname" == "bash" ]; then
exit 1
fi
fi
for bin in apt-get grep dpkg file lsb_release; do
for bin in apt-get grep dpkg file lsb_release yq; do
if ! type -p "$bin" >/dev/null; then
echo "Error: \`\`$bin\`\` not found" >&2
exit 1
fi
done
##
## Install docker
##
STATIC_DOCKER_URL="https://download.docker.com/linux/static/stable/x86_64"
distro=$(lsb_release -is)

19
precise/host/hooks/install.d/70-0k.sh

@ -277,3 +277,22 @@ fi
apt-get install -y pv buffer < /dev/null
apt-get install -y postgresql-client </dev/null
)
##
## Limit docker log size
##
## XXXvlab: if file changed, it would be nice to reload daemon,
## as a starter, but containers will need to be re-created to
## take effect
touch /etc/docker/daemon.json &&
yq e -i '
.log-driver = "json-file",
.log-opts = {
"max-size": "10m",
"max-file": "5"
}
' /etc/docker/daemon.json || exit 1
Loading…
Cancel
Save