In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the role of regularly cleaning up the mirror image of None through Jenkins, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
I. manual cleaning
A relatively simple cleaning method, which is suitable for manually executing the command to clean up the image when a single none image is generated, execute the following command:
Docker rmi $(docker images-f "dangling=true"-Q)
Since I no longer have a local image of none, the execution can only see the following effect
II. Clean up after the completion of the project production
When you set up a CI-compliant project in Jenkins, cleanup can be set in the build execution script after the production process is over, such as:
The script is:
Echo-Clear-Images...-clearImagesList=$ (docker images-f "dangling=true"-Q) if [!-n "$clearImagesList"]; thenecho "no images need clean up." elsedocker rmi $(docker images-f "dangling=true"-Q) echo "clear success." fi
When the project is built, execute this to clearly mirror the None generated during the build process, so that you can clear your own intermediates.
However, there is a serious problem. When two or more projects are built at the same time, the script that clears after building first will affect the project in the construction process, deleting the none generated during the construction process, but the deletion failure leads to an error, which leads to the failure of the project built first. This method is not recommended in the case of multiple projects, if only a single task is running in Jenkins. That's not a problem.
III. Scheduled task cleanup
I prefer this method. Create a new Jenkins scheduled task, such as the image I set to clean up to none at 12:00 in the evening, as follows:
1. Create a new project in Jenkins with a random name, such as mine is ClearImage.
2. Build the trigger, select Poll SCM, and set the timing time. For example, if I set it to clean up in the wee hours of the morning, you can also set another time. For more information, please see the question mark on the right.
3. Execute the build script. The content of the script has been given before, and you can save it.
Manually perform an immediate build to verify that it is valid:
View the console output:
Output completed: the build is valid.
Thank you for reading this article carefully. I hope the article "the role of regularly cleaning up the image of None through Jenkins" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel, and more related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.