docker

How do I look at what's cached by Docker


Experimenting and debugging a Dockerfile I change a line here and re-run and from the log output I can see "---> Using cache" and "---> b0efa....". My question is, where are those stored, am I filling my disk with detritus from my experimentation?


Solution

  • They are ordinary images (more specifically layers). You can look at what's inside by launching a container from one

    docker run --rm -it b0efa sh
    

    If you routinely run docker system prune that will clean up any unused images and the layers that go into them; if the cached layer is part of an image you're actually using, it takes no extra space.