Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker hub automated build depend on another docker hub repo

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?

like image 809
Surafel Avatar asked Mar 10 '18 13:03

Surafel


People also ask

What purpose do repository links serve in automated builds?

Repositories, that permits us to push images from a local Docker daemon to Docker Hub. And, automated builds, that link to a source code repository and trigger an image rebuild process on Docker Hub at the time when changes are detected in the source code.

How do I update automated repositories in Docker Hub?

From the Repositories page, click into a repository, and click the Builds tab. Click Configure automated builds to edit the repository's build settings. In the Build Rules section, locate the branch or tag you no longer want to automatically build. Click the autobuild toggle next to the configuration line.

Does Docker build push to Docker Hub?

Builds: Automatically build container images from GitHub and Bitbucket and push them to Docker Hub. Webhooks: Trigger actions after a successful push to a repository to integrate Docker Hub with other services.

How many private repositories are allowed for a individual on Docker Hub?

You get one private repository for free with your Docker Hub user account (not usable for organizations you're a member of).


2 Answers

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!

like image 123
Christophe Schmitz Avatar answered Sep 28 '22 01:09

Christophe Schmitz


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.

like image 34
Sven Höper Avatar answered Sep 28 '22 01:09

Sven Höper