<p>I have a base which is being used by 100 applications. All 100 applications have the common base image in their Dockerfile. Now, I am upgrading the base image for OS upgrade or some other upgrade and bumping up the version and I also tag with the latest version. 
 Here, the problem is, whenever I change the base image, all 100 application needs to change the base image in their dockerfile and rebuild the app for using the latest base image. 
 Is there any better way to handle this?</p>

<p><strong>Note :-</strong> I am running my containers in Kubernetes and Dockerfile is there in GIT for each application.</p>

user1578872
<p>You can use a Dockerfile <code>ARG</code> directive to modify the <code>FROM</code> line (see <a href="https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact" rel="nofollow noreferrer">Understand how ARG and FROM interact</a> in the Dockerfile documentation).  One possible approach here would be to have your CI system inject the base image tag.</p>

<pre><code>ARG base=latest
FROM me/base-image:${base}
...
</code></pre>

<p>This has the risk that individual developers would build test images based on an older base image; if the differences between images are just OS patches then you might consider this a small and acceptable risk, so long as only official images get pushed to production.</p>

<p>Beyond that, there aren't a lot of alternatives beyond modifying the individual Dockerfiles.  You could script it</p>

<pre class="lang-sh prettyprint-override"><code># Individually check out everything first
BASE=$(pwd)
TAG=20191031
for d in *; do
  cd "$BASE/$d"
  sed -i.bak "s@FROM me/base-image.*@FROM:me/base-image:$TAG/" Dockerfile
  git checkout -b "base-image-$TAG"
  git commit -am "Update Dockerfile to base-image:$TAG"
  git push
  hub pull-request --no-edit
done
</code></pre>

<p>There are automated dependency-update tools out there too and these may be able to manage the scripting aspects of it for you.</p>
