Skip to content
Latchkey

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 latest push does not redeploy every environment.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →