Does docker build --no-cache refresh updated remote base images or not? Documentation does not seem to specify.
相关问题
- Docker task in Azure devops won't accept "$(pw
- Unable to run mariadb when mount volume
- Unspecified error (0x80004005) while running a Doc
- What would prevent code running in a Docker contai
- How to reload apache in php-apache docker containe
The
--no-cache
option will rebuild the image without using the local cached layers. However, theFROM
line will reuse the already pulled base image if it exists on the build host (the from line itself may not be cached, but the image it pulls is). If you want to pull the base image again, you can use the--pull
option to the build command. E.g.To see all the options the build command takes, you can run
or see the documentation at https://docs.docker.com/engine/reference/commandline/build/
Here's an example for how you can test this behavior yourself:
docker build --no-cache
will rebuild your whole image without reusing cached layers but it will not pull the newest base image from the remote repository. It will just use your local stored image.--no-cache rebuilds image without using the cache, so it is essentially a clean build.
as per the help docker build --help --no-cache Do not use cache when building the image
Each dockerfile commands that we specify in the docker file like RUN, CMD, ADD create layers in your local system and this layers will be used by other docker images provided they too make use of same dockerfile command with same parameters.
When we specify docker build with "--no-cache" parameter then docker will ignore the local system docker image layers that were already available in the local system where you are building the docker and it always start the build as fresh build or from scratch and the reference count for the previous layer, if any; won't be added while building this new image layer.
You can find the layers of image by following this link Finding the layers and layer sizes for each Docker image