OpenShift 3.1 – Prevent Docker from caching curl resource

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:

  • Docker-compose Kubernetes ENV properties interoperability
  • What are the option to API gateway with docker?
  • Docker memory overhead
  • Using Docker to launch web app, can't connect to Postgresql DB?
  • How to develop Rails app running inside Docker
  • Building a docker image (.NET Core) and uploading it to Google Container Engine?
  • 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?

  • Change hostname after running a container
  • Cannot access a Kubernetes postgresql service from the outside
  • Node https.request to Docker API closes before full result is returned
  • Cohabitation Docker & VirtualBox on Windows
  • Docker swarm node hostnames are the same
  • Unable to locate runnable browser in Docker container
  • 3 Solutions collect form web for “OpenShift 3.1 – Prevent Docker from caching curl resource”

    According to the OpenShift docs ( you can force builds to not be cached using the following syntax:

      type: "Docker"
        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.

    You can bust the cache at a specific Dockerfile instruction using ARG.

    In the Dockerfile:

    RUN git clone 

    On the command line:

    docker build -t your-image --build-arg CACHEBUST=$(date +%s) . 

    Setting CACHEBUST to the current time means that it will always be
    unique, and instructions after the ARG declaration in the Dockerfile
    won’t be cached. Note that you can also build without specifying the
    CACHEBUST build-arg, which will cause it to use the default value of 1
    and preserve the cache. This can be used to always check out fresh
    copies of git repos, pull latest SNAPSHOT dependencies, etc.



    You can use –no-cache, or –build-arg to invalidate the cache. You
    can minimize the effect of –no-cache by having a base image with all
    the cacheable commands.


    I can’t control the way docker is run, I mean I am running in a PaaS that calls my dockerfile so I can’t pass arguments in docker build

    You could try and control the content of your Dockerfile though.

    If you can re-generate the Dockerfile before letting the PaaS calling it, that would help making sure the cache is invalidated:

    sed -i 's/ROOT.war.*/ROOT.war && echo $(date)'/g' Dockerfile
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.