Docker gotchas ( 2. Docker build with –no-cache)

There is always a misconception that when you build an image from the docker file in a frequent interval, which has base image defined something like below, the base image updates ( for example a CVE or vulnerability fix) are by default pulled into your newly built image. This is wrong!

For example:

[terminal]
FROM fedora21
[/terminal]

Docker uses the caches when building and when there is no change in the instructions of Dockerfile, docker skips doing an update of the image to the latest version.
To avoid/overcome this, remove the cache in the build process! but, how? below is the method you can use to remove the cache while building docker image.

[terminal]
#docker build -no-cache .
[/terminal]

Digiprove sealCopyright secured by Digiprove © 2017-2020 Humble Chirammal