Docker Community Forums

Share and learn in the Docker community.

Automatic re-build of depending images

(Winniwinter) #1

currently I have a set of Docker Images that has a certain hierarchy e.g.:


  • docker-jdk7-image:latest
  • docker-tomcat-image:latest

If I now do some changes on my docker-base-image Dockerfile, e.g. adding
RUN apt-get install -y procps

I currently delete all images depending on that one and re-build every single one of them.
Is there somehow the possibility to automatic re-build all depending images if a change of one in the higher hierarchy layer was detected?

That means I would change something within my base image and create a new one. The existing images would detect the changes and rebuild themselves.

(Sven Dowideit) #2

the Docker Hub has that kind of dependency rebuild triggers - you can Link auto-build repo’s together.

(Winniwinter) #3

thanks! I just added one. Looks good. Currently I have a git repository with multiple dockerfiles within different folders.
the structure is basically

  • base
  • postgres
  • tomcat
  • apache
  • webapp

If I know change something within the webapp Dockerfile and push it to the remote Every Image is updated. Is that the attended way?

Normally I only want a full rebuild if, let’s say I would change something within the base image

(Sven Dowideit) #4

yes, for now, if any file in a GitHub repo is changed, all Hub repositories are rebuilt.

(Winniwinter) #5

That sometimes could lead to some problems e.g if I have a tomcat image and a webapp image. The webapp image is build FROM tomcat image…
If I change the Dockerfile of the tomcat image it can happen that the webapp image is build with the old version of the tomcat image instead with the updated one. I then have to manually re-build the webapp image.

The more hierarchy I have the more tedious it get’s

base image
  - jdk image
   - tomcat image
    - webapp image

I think automated builds are really great, but I think it needs a little bit more intelligence. If the upper image changes it should trigger a re-build of the sub-images that reference to the upper image…at least it should send some notification which could trigger again something.
Currently I’m thinking if our CI Server could do this kind of intelligence and at the end just push the image to the hub

(Sven Dowideit) #6


I’ve added your information to the internal issue tracking system.

cc @kencochrane1