How to Trigger CI From Docker Hub and Registry Webhooks
A registry webhook fires when a new image tag is pushed, letting a handler start a redeploy automatically.
Configure the registry to POST to your handler on push. Docker Hub sends a JSON payload with the repository and pushed tag; validate it, then trigger your deploy.
Steps
- Add a webhook in the registry settings pointing at your handler.
- Parse the repository and pushed tag from the payload.
- Trigger a deploy or a repository_dispatch for the matching tag.
Handler
handler.js
app.post('/registry-hook', (req, res) => {
const { repository, push_data } = req.body;
const image = repository?.repo_name;
const tag = push_data?.tag;
if (!image || !tag) return res.status(400).end();
triggerDeploy(image, tag);
res.status(200).end();
});Gotchas
- Docker Hub webhooks have no shared-secret signature; gate the endpoint with a secret path token or allowlist.
- Filter on the tag so a
latestpush does not redeploy every environment.
Related guides
How to Secure a Webhook EndpointSecure a webhook endpoint by requiring a verified signature, serving only over TLS, and optionally restrictin…
How to Trigger CI From a Webhook With repository_dispatchTrigger a GitHub Actions workflow from an external system by POSTing a repository_dispatch event to the REST…