【Vegas原创】清理docker logs

2年前 (2022) 程序员胖胖胖虎阿
253 0 0

1,docker ps找到id

[root@mysql3 /]# docker ps
CONTAINER ID   IMAGE       COMMAND                  CREATED       STATUS             PORTS                                                  NAMES
1d8a4fbdaa6b   wordpress   "docker-entrypoint.s…"   4 weeks ago   Up 2 minutes       0.0.0.0:81->80/tcp, :::81->80/tcp                      wordpress
b310463fd2a5   mysql       "docker-entrypoint.s…"   4 weeks ago   Up About an hour   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp   mysql

2,docker inpect 找到路径

[root@mysql3 /]# docker inspect --format='{{.LogPath}}' 1d8a4fbdaa6b
/var/lib/docker/containers/1d8a4fbdaa6b07c8bcfbca1938d30703f5775841bc3f84b12e88f4c27650cefd/1d8a4fbdaa6b07c8bcfbca1938d30703f5775841bc3f84b12e88f4c27650cefd-json.log

3,echo >  刚才的完整路径

[root@mysql3 /]# echo > /var/lib/docker/containers/1d8a4fbdaa6b07c8bcfbca1938d30703f5775841bc3f84b12e88f4c27650cefd/1d8a4fbdaa6b07c8bcfbca1938d30703f5775841bc3f84b12e88f4c27650cefd-json.log
[root@mysql3 /]#
版权声明:程序员胖胖胖虎阿 发表于 2022年9月16日 下午12:08。
转载请注明:【Vegas原创】清理docker logs | 胖虎的工具箱-编程导航

相关文章

暂无评论

暂无评论...