惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
AI
AI
NISL@THU
NISL@THU
AWS News Blog
AWS News Blog
V
Visual Studio Blog
博客园 - 三生石上(FineUI控件)
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Privacy & Cybersecurity Law Blog
S
Schneier on Security
PCI Perspectives
PCI Perspectives
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Troy Hunt's Blog
云风的 BLOG
云风的 BLOG
N
News and Events Feed by Topic
Know Your Adversary
Know Your Adversary
F
Fortinet All Blogs
Spread Privacy
Spread Privacy
P
Proofpoint News Feed
Jina AI
Jina AI
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
WordPress大学
WordPress大学
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Vulnerabilities – Threatpost
P
Privacy International News Feed
T
Tor Project blog
S
Security Affairs
S
Securelist
F
Full Disclosure
D
Docker
酷 壳 – CoolShell
酷 壳 – CoolShell
Martin Fowler
Martin Fowler
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
SecWiki News
SecWiki News
P
Palo Alto Networks Blog
Apple Machine Learning Research
Apple Machine Learning Research
N
News and Events Feed by Topic
Recorded Future
Recorded Future
The Hacker News
The Hacker News
Google Online Security Blog
Google Online Security Blog
Stack Overflow Blog
Stack Overflow Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
I
Intezer
Security Latest
Security Latest
Scott Helme
Scott Helme
U
Unit 42
Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog

博客园 - 不是豆豆

切换 Google Play 国家地区 NuGet 命令行记录 在 UnionTech OS Server 20 Euler 64bit 上安装 docker 环境 在 Windows 7 SP1 或 Windows Server 2008 R2 SP1 系统中安装 ASP.NET Core 10.0 运行时环境 记录各版本 Microsoft Visual C++ Redistributable 官方下载地址 在 PolarDB-PG 上安装 pgvector 扩展 在 microsoft onnxruntime 中使用 arcface model 出错:Invalid input scale: NumDimensions() != 3 在 Windows 下为 PostgreSQL 安装 pgvector 插件 如果两个 Steam 库文件夹中,有相同的两份游戏,这时删除第二份会怎样? 当 linux 主机内存较小运行程序(如 yum update)被 Killed 迁移 Gitea 从 Windows 到 Linux Docker 容器中(使用 SQLite 数据库) 在 EF Core 中使用传统的 DbFirst 模式 在 SkiaSharp 中对图片进行缩放时,结果锯齿较多的处理方案 在 asp.net core web 项目中,创建项目时因选择容器化部署,未配置 IIS Express 应如何进行修改 如何重置 sftpgo 的管理员密码 微信鸿蒙版 8.0.14 查询 navigator.maxTouchPoints 为 0 导致的 bug 在本地 claude code 中使用 copilot pro 订阅 在安装 miniforge3(conda)环境后,每次启动终端(PowerShell)都非常缓慢的处理方案 在 .net framework 4.8 下,若因为安装或升级了 System.ValueTuple 出现问题 在 Windows 11 系统下,日常使用浏览器(Edge、Chrome)常遇到画面撕裂或浏览器在经切换窗口后显示内容不正常 关于 CVE-2025-55315 漏洞问题查验记录 在 gitea 服务器端查询 lfs 文件占用情况 编写 GKD 规则 在 Windows 下 .net 项目中,使用 ViGEm 模拟游戏手柄 为传统 .net framework 项目切换 nlog 日志 测试支持 PolarDB-X(高度兼容 MySQL) 的客户端图形工具 SteamDeck 重置系统密码教程 新版本 portainer ce 在操作容器时,报错 Forbidden - origin invalid
处理过大的 docker 日志
不是豆豆 · 2025-08-08 · via 博客园 - 不是豆豆

1、发现时 docker 日志已经很大了,最方便的肯定还是直接重建容器,日志也就重新初始化了

查找过大的容器目录

cd /var/lib/docker/containers
du -h -d 1 | sort -h

查看文件内容

tail -n 10 your_file.log

2、如果不想重建容器,那就需要找到日志文件,一种是直接清空:

truncate -s 0 your_file.log

3、或者保留文件最后 1GB:

truncate -s 1G your_file.log

4、处理完当前问题 ,为了预防未来再次发生,可以限制日志大小(需重建容器)

单个容器配置:

# 在容器运行命令中添加
# 示例
docker run -d -p 80:80 -p 443:443 \
--log-opt max-size=1g \
--name nginx nginx

全局配置(仍然只对新建容器生效):

sudo vi /etc/docker/daemon.json

添加以下配置,保存并退出:

{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  }
}

参考:https://cn.linux-console.net/?p=34396

https://www.cnblogs.com/BillyLV/articles/12555451.html

https://chatgpt.com/