Docker Hub: Save and Share Your Docker Images
See how you can set up your Docker Hub account to save your images as well as share them around. Also see how you can use webhooks to create automated builds.
Join the DZone community and get the full member experience.
Join For FreeThe Docker Hub is a cloud-based registration service for the construction of container applications or services.
It provides a centralized resource for image container discovery, distribution, and change management, as well as user and team collaboration and workflow automation throughout the development pipeline.
Docker Hub provides the following features:
Image repository : Find, manage and push and pull of community images, official and private image libraries.
Automated build : Automatically create new images when you make changes to a code that is on GitHub or bit bucket.
Webhooks: A feature of automated builds, webhooks let you trigger actions after a successful push to a repository.
Organization: Create working groups to manage user access to repositories of images.
Steps
1. Public repository:
It's a list of all images available on the public repository.
2. Here, I got an existing image:
3. I logged in my Docker hub account:
4. I tagged it to send the image to my account:
Now I have two images, the original and my own version.
5. In the end, I pushed to the repository:
6. If I check my Docker Hub account, I can see the image I sent.
Webhooks
The webhook is an HTTP callback triggered by a specific event.
You can use a webhook to notify people, services, and other applications after a new image is sent to your repository.
To start adding webhooks, scroll to the desired repository in the Hub and click "Webhooks" under the "Settings" box. The webhook is called only after a successful push is made.
Call webhooks are HTTP POST requests with a JSON payload similar to the example shown below.
After I create my webhook, I will see the following:
Just to test this webhook, I used this site: http://requestb.in.
This site will provide one URL for the webhook URL abd provides another URL to check the request:

Automated Build
You can build your images automatically from a compilation context stored in a repository. A building context is a Dockerfile and any files in the specific location.
For an automated build, the building context is a repository where it sends a Dockerfile. The use of automated builds requires that you have an account on Docker Hub and a hosted repository provider on GitHub or BitBucket.
If you already have on your Github or BitBucket account, you must have chosen the type of public and private connection.
After each commit is mapped, it is possible to see a table with the status of each image build with the code committed.
And it is possible to combine an automated build with webhooks, the result of which can be deployed.
These functionalities for webhooks and automated building are limited in private mode. Each user has one private repo and parallel build, and this pipeline does not happen immediately for free accounts.
For more information, take a look at my slides.
Opinions expressed by DZone contributors are their own.
Comments