Skip to content

Instantly share code, notes, and snippets.

@peacengell
Forked from carlessanagustin/dockerlog_setup.sh
Created December 20, 2018 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peacengell/894d67bbaaaae37e4bb3c22c09078a18 to your computer and use it in GitHub Desktop.
Save peacengell/894d67bbaaaae37e4bb3c22c09078a18 to your computer and use it in GitHub Desktop.
Docker log setup - apply: wget -O - https://goo.gl/x86FN9 | sudo bash
#!/usr/bin/env bash
# empty log file: echo "" > $(docker inspect --format='{{.LogPath}}' <container_name_or_id>)
# apply: wget -O - https://goo.gl/x86FN9 | sudo bash
FILEPATH=/etc/docker/daemon.json
cat << EOF > $FILEPATH
{
"log-driver": "json-file",
"log-opts": {
"max-size": "100m",
"max-file": "7"
}
}
EOF
systemctl restart docker.service || service docker restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment