清理docker logs

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 /]#

posted @ 2021-08-12 14:47  李济宏(Amadeus)  阅读(120)  评论(0编辑  收藏  举报