---
# System prepended metadata

title: Docker 限制 Stdout (console output) Max Size
tags: [' linux', ' stdout', docker]

---

---
tags: docker, linux, stdout
---
# Docker 限制 Stdout (console output) Max Size
```bash=
# edit docker daemon setting
vim /etc/docker/daemon.json

# 加入以下幾行
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m",
    "max-file": "3"
  }

# restart docker daemon
systemctl restart docker.service

# check disk
cd /var/lib/docker/containers/ && du -hs *
```
