Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove intermediate images when using docker multi-stage builds #1277

Closed
mkurz opened this issue Nov 4, 2019 · 1 comment
Closed

Remove intermediate images when using docker multi-stage builds #1277

mkurz opened this issue Nov 4, 2019 · 1 comment
Labels

Comments

@mkurz
Copy link
Member

mkurz commented Nov 4, 2019

Each time running the docker plugin with MultiStage as dockerPermissionStrategy (which is the default) an untagged image will be created (in addition to the final image). That is just how multi-stage works. However, this can escalate quickly and you get many many untagged images which (usually) no one ever needs. Therefore I propose to add a config (like autoCleanupIntermediateImages) which makes the plugin remove those images after docker:publish... has finished (we can even turn it on by default).
The solution is very easy, we just need to label the created intermediate image and then remove images with this label:
moby/moby#34513 (comment)

I propose to add two labels, one specific one for that image, so we can remove exactly that image on build cleanup and one general label, in case autocleanup is disabled, someone can later still remove all intermediate images generated by the docker plugin by just filtering for that general label.

@muuki88 muuki88 added the docker label Nov 5, 2019
@muuki88
Copy link
Contributor

muuki88 commented Nov 5, 2019

Thanks for this feature request. This duplicatse #1229

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants