sdk-container-builds
sdk-container-builds copied to clipboard
Option to avoid storing a pushed image
Currently, the layer generated by the build is stored in %TEMP%/Containers/Content (see in the ContentStore class), and the documentation says you should use docker to cleanup those manually.
I have a service which builds and pushes images regularly, and it ended up filling its disk space because of those local layers. I don't want to install docker or have to clean up these layers manually, so I ended up reading the binlog, which contains the container manifest (in the GeneratedContainerManifest output property of the CreateNewImage task), which lists the layer digests, then delete the files based on this info.
It would be nice to have something like a ContainerCleanup or ContainerStoreLocally MSBuild property which would do this cleanup automatically. This would enable having a build server which doesn't fill up its temp directory unnecesarily.
I suppose removing only the last layer would be sufficient since this is the one which contains the built files, but I may be wrong.
This is a rough one - we don't have a good management story for the layer/manifest cache at all. Some options:
- [ ] Allow the 'container content root' to be set via property or other user control, so its location is knowable and can be deleted by a user easily
- [ ] provide an explicit target that will purge the 'container content root'
- [ ] make some kind of configuration that the tasks could conditionally use to determine cleanup policies for the 'container content root'