I'm new to Docker and I noticed that my builds aren't utilizing the cache at all. I checked the build logs and it shows that none of the 20 steps are cached. I haven't changed the order of my Dockerfile, so I shouldn't have messed up the layering. Here's the relevant build information: The build started on June 30, 2025, at 8:37 AM and ended at 2:05 PM, taking a total of 5 hours and 27 minutes. I really want to understand why caching isn't working for me, any thoughts?
3 Answers
It sounds frustrating! One thing to check is if there are any issues in your Dockerfile that might cause the cache to be invalidated, like changing something in one of the earlier layers. If you want more specific help, sharing your Dockerfile would really help us diagnose the issue.
Are you building directly on your laptop or through a CI/CD pipeline? Sometimes the environment can make a difference in caching behavior.
I’m also curious about your build command. How are you initiating it? It might be a reason why caching isn’t working as expected.
I'm using docker build -f docker/Dockerfile -t repo/app:v9 .
Yeah, I'm building it right on my laptop.