hub-feedback
hub-feedback copied to clipboard
Docker Hub Automated builds do not cache layers
Builds are slower on Docker Hub compared to building the same Dockerfile on a static same host. This is especially evident if bringing in a large number of dependencies (e.g. node npm install).
It would be good if layers from previous build could be re-used across runs. This would reduce the amount of CPU time builds take, and reduce bandwidth requirements.
I suspect that this is partially a feature, not a bug.
Consider a layer such as
RUN apt update
If you build this locally, you will notice that this layer gets cached. But the command is non-deterministic. After a couple of days, you do NOT want to cache this any longer, because you want your images to include the newer, more up-to-date package lists.
Locally, it is not a problem. You just tell docker build
not to cache this time. For automated builds on docker hub, you would need a way to specify how often the cache should get invalidated.
I presume that the developers of Dockerhub did not want to deal with such problems and therefore decided to simply never cache.
I agree that it is annoying, though :)
It takes me 15 minutes after every little push for my project to be built, because the node npm packages keep getting installed from scratch over and over again. So I take it I should stop using Docker Hub and created builds myself manually if I wanted layers to be cached :(
still not caching layers ?