dockerÔõôÕûÀíÄڴ滺´æ
ΪÁËÕûÀí docker Äڴ滺´æ£¬¿ÉÒÔ×ñÕÕÒÔÏ°취£ºÊ¹Óà docker system prune ÏÂÁî×Ô¶¯ÕûÀí»º´æ¡¢Í¼Ïñ¡¢ÈÝÆ÷ºÍ¾í¡£Ê¹Óà docker image prune ÏÂÁîɾ³ýδʹÓõÄͼÏñ¡£Ê¹Óà docker container prune ÏÂÁîɾ³ýÒÑ×èÖ¹ÇÒδʹÓõÄÈÝÆ÷¡£Ê¹Óà docker volume prune ÏÂÁîɾ³ýδʹÓÃµÄ¾í¡£Ê¹Óà docker-clean ¹¤¾ß¾ÙÐиüϸÄåµÄ»º´æÕûÀí¡£µ÷½â docker ÄÚ´æÏÞÖÆÒÔÔöÌí·ÖÅɵÄÄÚ´æÁ¿¡£°´ÆÚÖ´ÐÐÕâЩ°ì·¨£¬²¢Ê¹Óüà¿Ø¹¤¾ß»ò cron ×÷
ÔõÑùÕûÀí Docker Äڴ滺´æ
Docker ʹÓûº´æÀ´ÓÅ»¯Æä²Ù×÷£¬µ«Ëæ×Åʱ¼äµÄÍÆÒÆ£¬»º´æ¿ÉÄÜ»áÔöÌí²¢Õ¼Óôó×ÚµÄÄÚ´æ¡£ÒÔÏÂÊÇÓÐÖúÓÚÕûÀí Docker Äڴ滺´æµÄ°ì·¨£º
1. ʹÓà docker system prune ÏÂÁî
docker system prune ÏÂÁî¿ÉÒÔ×Ô¶¯ÕûÀí Docker »º´æ£¬°üÀ¨Í¼Ïñ¡¢ÈÝÆ÷¡¢¾íºÍÍøÂç¡£Ëüͨ¹ýɾ³ý²»ÔÙʹÓõÄÏîÀ´ÊÍ·Å´ÅÅÌ¿Õ¼äºÍÄÚ´æ¡£ÈôÒªÔËÐдËÏÂÁÇëÊäÈ룺
docker system prune
µÇ¼ºó¸´ÖÆ
2. ɾ³ýδʹÓõÄͼÏñ
δʹÓõÄͼÏñ»áÕ¼Óôó×ڵĴÅÅÌ¿Õ¼äºÍÄÚ´æ¡£°´ÆÚʹÓà docker image prune ÏÂÁîɾ³ýδʹÓõÄͼÏñ£º
docker image prune
µÇ¼ºó¸´ÖÆ
3. ɾ³ýδʹÓõÄÈÝÆ÷
δʹÓõÄÈÝÆ÷Ò²»áÏûºÄÄڴ档ʹÓà docker container prune ÏÂÁîɾ³ýÒÑ×èÖ¹ÇÒ²»ÔÙÐèÒªµÄÈÝÆ÷£º
docker container prune
µÇ¼ºó¸´ÖÆ
4. ɾ³ýδʹÓõľí
δʹÓõľíÒ²»áÏûºÄÄڴ档ʹÓà docker volume prune ÏÂÁîɾ³ýδʹÓÃµÄ¾í£º
docker volume prune
µÇ¼ºó¸´ÖÆ
5. ʹÓà docker-clean ¹¤¾ß
Docker-clean ÊÇÒ»¿îµÚÈý·½¹¤¾ß£¬¿ÉÌṩ¸üϸÄåµÄ»º´æÕûÀíÑ¡Ïî¡£Ëü¿ÉÒÔɾ³ýͼÏñ¡¢ÈÝÆ÷¡¢¾íºÍÍøÂçÖеÄÌض¨ÄÚÈÝ¡£Òª×°Öà docker-clean£¬Çëƾ֤Æä GitHub Ò³ÃæÉϵÄ˵Ã÷¾ÙÐвÙ×÷¡£
6. µ÷½â Docker ÄÚ´æÏÞÖÆ
ÈôÊÇ Docker ÄÚ´æʹÓÃÂʺܸߣ¬¿ÉÒÔÔöÌí·ÖÅɸø Docker µÄÄÚ´æÁ¿¡£ÔÚ /etc/docker/daemon.json ÉèÖÃÎļþÖУ¬ÕÒµ½ memory-swap ºÍ memory-limit ²ÎÊý£¬²¢Æ¾Ö¤ÐèÒªÔöÌíÆäÖµ¡£
°´ÆÚά»¤
ΪÁ˱ÜÃâ Docker »º´æÔöÌí¹ý´ó£¬°´ÆÚÖ´ÐÐÕâЩÕûÀí°ì·¨ºÜÊÇÖ÷Òª¡£¿ÉÒÔÉèÖà Cron ×÷Òµ»òʹÓüà¿Ø¹¤¾ßÀ´×Ô¶¯»¯´ËÀú³Ì¡£
ÒÔÉϾÍÊÇdockerÔõôÕûÀíÄڴ滺´æµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡