跳至主要内容

docker解决stdout log文件越来越大的问题

  1. Edit the daemon configuration file:
    $ vim /etc/docker/daemon.json
    
  2. Add the following lines to file:
    {
    "log-driver": "json-file",
    "log-opts": {
        "max-size": "10m",    
        "max-file": "3"    
        }
    } 
    
  3. Restart the docker daemon: systemctl restart docker 
  4. Chinese File with mirrors
    {
      "log-driver": "json-file",
      "log-opts": {
        "max-size": "10m",
        "max-file": "3"
      },
      "registry-mirrors": [
        "https://dockerhub.azk8s.cn",
        "https://n6mdpfki.mirror.aliyuncs.com",
        "https://reg-mirror.qiniu.com",
        "http://hub-mirror.c.163.com",
        "https://docker.mirrors.ustc.edu.cn",
        "https://registry.docker-cn.com"
      ]
    }

评论

此博客中的热门博文