Home > Mobile >  Why does `docker build` sometimes not do anything and how can I force it to always build
Why does `docker build` sometimes not do anything and how can I force it to always build

Time:05-04

I'm doing go development. Sometimes when I do docker build it doesn't build. It's pretty obvious by the output, since the build process has to download some libs into the container. What can I put in my Dockerfile to force it to always build?

CodePudding user response:

Docker build will only re-build where there is a change in your Dockerfile.

It will cache what it has built that has not changed so it does not have to do it again later.

You can use --no-cache to force this, but I wouldn't do this every build as just wastes time, effort, and computing power.


Here are the official docs to this feature: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#leverage-build-cache

CodePudding user response:

can use
docker build --no-cache

  • Related