How to manage multiple dockerfile in multiple applications

Hi,

Story:
We have an application that consist of 20 applications/containers and growing. Where:

  • Use Jenkins for CI/CD
  • .Net Applications
  • We don’t use Docker-compose for some limitations and how the pipeline is set

Problem:
The 20 dockerfile for the containers uses .Net 5 as base image, however the issue when we will update to .Net 6 (or patched versions of .Net 5) then we will have to manually update each file which sometimes is hard and we might forget some.

One thing we thought of is to have the base image name in an external file (base_image.txt) and when we build the image it then goes to the external file and read the image name from there. So, in this case we have to make the change in one place.

Any idea how to achieve this? or if there are different approaches (without the use of docker-compose)?

Thanks,

Good evening,

my simple idea is to tag you base-image (currently the .Net5-one, which you have already pulled to your machine - let’s call it oldbaseimagename) with something different, i.e.

docker tag oldbaseimagename mybaseimage

Now you can change all of your Dockerfiles to base on mybaseimage instead of oldbaseimagename and continue using the old oldbaseimagename using the new tag. Keep in mind, that you have to repeat the docker tag ... every time you pull a new oldbaseimagename.

At some point in time you want to switch to the .Net6-base-image. Pull it (let’s assume the new name is newbaseimagename) and tag this as mybaseimage

docker tag newbaseimagename mybaseimage

Now you can build all your containers again without changing the Dockerfiles again, because now mybaseimage points to newbaseimagename.

Don’t know if this is the best idea - but it is simple and should work :slight_smile: .

Thank you so much,

I thought of doing it this way but maybe there was a way through some file we can control this.
But having someone else suggest the same thing makes it a valid way which seem what I will do.

Thanks again :slight_smile: