last day (16 days later) » 

21:03
0
A: How to remove intermediate images from a build after the build?

d4nyllAs ZachEddy and thaJeztah mentioned in one of the issues you linked to, you can label the intermediate images and docker image prune those images based on this label. Dockerfile (using multi-stage builds) FROM node as builder LABEL stage=builder ... FROM node:dubnium-alpine ... After you've ...

Any idea how do I tell ones that are from this particular build as opposed to similar ones built by a different build agent on the same build machine? Note, the question is in the context of solving this problem in CI/CD context, etc Jenkins or Teamcity build.
@AndrewSavinykh Perhaps you can set a unique build ID as an environment variable inside your Jenkins build, add it to the image using ENV, and use environment replacement to use that build ID as the label value
I just read that article you linked before posting my first comment. It appears that it is not possible to do without modifying Dockerfile. Are you proposing modifying Dockerfile during the build? (It's certainly possible but would need to read, parse modify and then write the Dockerfile, which is a complexity I'd rather avoid)
Yes you'd need to modify the Dockerfile to include the ENV and LABEL instructions. I am not sure why this is a complex procedure, would you mind clarifying?
Well parsers for most formats that is more complex than trivial tend to be quite complicated. You cannot just insert LABEL stage={$buildId}-N at a random place in file. You would need to find where to insert each of those, for that you ideally need to build and then work Abstract Syntax Tree and all that if you want to make sure that your insert does not interfere with some other feature of the Dockerfile. Since it's part of automated process you cannot run it on a single Dockerfile and fix if it does not run, you need to run it reliably on all Dockerfiles, etc.
21:03
A LABEL instruction is not going to interfere with your build process. The label is purely metadata that the docker daemon uses. Nothing 'inside' the image itself gets changed. I'd advise you to read the documentation more closely, as this is precisely what the LABEL instructure is made for. If you find yourself implement your own Dockerfile parser, you are over-complicating things.
I'm not sure why are you mentioning the inside of the image. While what you are saying is true, it does not address my concern above since it's not directly related to it. By now it's quite obvious that I'm struggling to get my point across and you are struggling to understand it. If you can think of a way to proceed please let me know, or we can let the matter rest.
21:40
You're right, I don't really understand your point. You want to get rid of the intermediate images after the build has complete. And I am saying you can do that with ENV and LABEL. You do not need to implement your own parser.
I think we are at different timezones, but I will reply to you when I can (:
21:52
If you find yourself implement your own Dockerfile parser, you are over-complicating things. How do you inject build id into a Dockerfile without that?

  last day (16 days later) »