Olaf Mandel
Olaf Mandel

Reputation: 827

Docker Hub: Repository Links for Automated Builds

In Docker Hub one can configure Automated Builds by clicking on the corresponding button in the upper-right corner of the Builds tab. Apart from configuring a rebuild on pushing to the source-code repository containing the Dockerfile, one can also set "Repository Links" to "Enable for Base Image". This is intended to "Trigger a build in this repository whenever the base image is updated on Docker Hub".

I got this to work in some simple toy-example cases. But it fails to trigger on a more complex example. My Dockerfile looks something like this:

FROM mediawiki AS orig

FROM alpine AS build
COPY --from=orig <file> /
RUN <patch-command of file>

FROM mediawiki
COPY --from=build <file> /

Why does the rebuild not trigger if (either of) the base-images gets updated? Is this because I have more than one FROM line in the Dockerfile? Or did the warning "Only works for non-official images" apply to the base image instead of the destination image?

If the answer to my last question above is "yes", is there some way to still get the desired effect of rebuilding on base image updates?

Upvotes: 3

Views: 1176

Answers (1)

peterevans
peterevans

Reputation: 41980

"Only works for non-official images"

I'm fairly sure it doesn't work for any official images like alpine, golang, etc. The reason is that so many images depend on those base images that a single update would be a huge burden on their infrastructure to rebuild everyone's images.

My guess is that the logic to determine whether an image uses an official image or not is very basic and if it detects FROM <some-official-image> anywhere in your Dockerfile then it probably won't get automatically rebuilt.

Upvotes: 3

Related Questions