问题
I know the procedure and also how to configure an automated docker hub from GitHub or BitBucket.
But what I have to do right now is to create two docker hub repositories called Test/main
and Test/depend
.
The first repository Test/main
is connected with GitHub and whenever there is a new push the image will be automatically build. But I want to trigger another repository Test/depend
whenever there is a change on the Test/main repository.
Is it possible to configure such scenario?
回答1:
This can be done with DockerHub:
You need to go to the build settings
of Test/depend
, and look for the section Repository Links. It says:
Link your Automated Build to another Docker Hub repository, and when that repository is updated, it will automatically trigger a rebuild of this Automated Build.
So you just have to add Test/main
int the box an you good to go!
回答2:
I would like to add important information to the answer above.
Repository links do not work with images from the docker library (all image names without a slash / beginning with _/). Apart from that several issues arised in the past which were not taken seriously by Docker Inc, so far (for some of them this means years).
There are multiple issues on GitHub (docker/hub-feedback#518, docker/hub-feedback#1587, partly docker/hub-feedback#1717, docker/hub-feedback#945, docker/hub-feedback#586). In the meantime they added a small hint (that links do not work for official base images) but it is still possible to enable it when your base image is an official image, without any further warning. The hint can only be seen when hovering over the decent info icon.
Some of the issues referenced also indicate that repository links for non official repositories did not work reliably in the past and Docker Inc wasn't very responsive. I recommend to NOT rely on repository links on Docker Hub.
来源:https://stackoverflow.com/questions/49209703/docker-hub-automated-build-depend-on-another-docker-hub-repo