I have this curl command in my Dockerfile:
RUN curl -H 'Cache-Control: no-cache' -f ${NEXUS_URL}${ARTIFACT_PATH}-${ARTIFACT_VERSION}.war?nocache=true -o $JBOSS_HOME/standalone/deployments/ROOT.war
The first time I ran it I could see the download information. However after that it seems to be caching the remote resource and thus, not updating it anymore:
Step 6 : RUN curl -H 'Cache-Control: no-cache' -f ${NEXUS_URL}${ARTIFACT_PATH}-${ARTIFACT_VERSION}.war?nocache=true -o $JBOSS_HOME/standalone/deployments/ROOT.war
30 ---> Using cache
31 ---> be50412bf6c3
How could I prevent this?
Disabling caching You can do so by passing two arguments to docker build : --pull : This pulls the latest version of the base Docker image, instead of using the locally cached one. --no-cache : This ensures all additional layers in the Dockerfile get rebuilt from scratch, instead of relying on the layer cache.
Leverage build cache As each instruction is examined, Docker looks for an existing image in its cache that it can reuse, rather than creating a new (duplicate) image. If you do not want to use the cache at all, you can use the --no-cache=true option on the docker build command.
Run Docker Container as a Service Docker team recommends to use cross-platform built-in restart policy for running container as a service. For this, configure your docker service to start on system boot and simply add parameter --restart unless-stopped to the docker run command that starts YouTrack.
The Docker platform runs natively on Linux (on x86-64, ARM and many other CPU architectures) and on Windows (x86-64). Docker Inc. builds products that let you build and run containers on Linux, Windows and macOS.
According to the OpenShift docs (https://docs.openshift.com/enterprise/3.1/dev_guide/builds.html#no-cache) you can force builds to not be cached using the following syntax:
strategy:
type: "Docker"
dockerStrategy:
noCache: true
This will mean that no steps are cached, which will make your builds slower but will mean you have the correct artifact version in your build.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With