I’m using rancher pipelines to deploy my service immediately after I push my code to GitHub, it always creates a new image but would never clean it.
I guess other continuous integration solutions would do the same.
Next, I’m going to share some lines of code on how to deal with it.
Let’s say the project I’m going to build is named GetShitDone.
The way to clear old images is as simple as copy and paste the codes below.
The images that are still in use would be protected and wouldn’t be removed.
It’s safe to use these commands.
If you would like to keep the images for months or longer, you can remove the
weeks ago and
months ago part.
That’s all of it, cheers.