Docker Community Forums

Share and learn in the Docker community.

Remove a cached docker build image


We have a docker image that we create which generally works fine. The problem is that we also have a python module dependency that needs to be version 0.6.4. The problem is that the version in the docker build cache is 0.5.4 which means that the built docker container never has the correct version within it.

The docker build always reports that it is using the cached version.

I know that I can stop caching for the whole build (which I don’t want to do, I just want to pull this one package).
I have tried to remove the images manually from the /var/lib/docker folder, that just broke the build completely and had to restart docker to recover.

I know that a recommendation is to use pip install -r requirements.txt but I wondered if there was a method to manually remove a single docker image that was in the build cache without having to delete everything and download from scratch?

I tried the docker system prune but that didn’t remove everything (I am possibly running an out-of-date docker version).

Any thoughts etc appreciated.