Docker overlay 清理空間

docker 生產環境

  • overlay2 (掛載高新能磁盤/大容量)
  • 運行容器,需要指定日誌格式/大小。

rabbit 容器日誌佔滿磁盤

myrabbit

docker run 指定日誌大小:

docker run --name myrabbit -d --log-driver="json-file" --log-opt max-size=10m  -p 35672:5672 -p 45672:15672 -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=xxxx rabbitmq:3.8.11-management

log

find log file:

[email protected]:~# docker inspect myrabbit | grep log
        "LogPath": "/var/lib/docker/containers/61926159b493cad091e92e2fe0810adeb418a9797dd24421cf146aea7e604235/61926159b493cad091e92e2fe0810adeb418a9797dd24421cf146aea7e604235-json.log",

clean log

echo "" > /var/lib/xxxx-json.log

docker prune

[email protected]:~# docker system prune
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all dangling images
  - all dangling build cache

Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B
[email protected]:~#
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章