The Wayback Machine - https://web.archive.org/web/20160305024032/https://docs.docker.com/docker-hub/webhooks/
Get Started
Quickstart containers Understand the architecture
Migrate to Engine 1.10 Breaking changes Deprecated Engine Features FAQ
Release Notes
Learn about Dockerfiles and Docker Cloud Back up data volumes Create a proxy or load balancer Install the Deploy to Docker Cloud button Integrate with Slack Push images to Docker Cloud SSHing into a Docker Cloud-managed node Upgrade Docker Engine on a node Use the Docker Cloud Agent Using the Docker Cloud CLI
API reference
Quickstart contribution FAQ for contributors Where to chat or get help Style guide for Docker documentation

Webhooks for automated builds

If you have created an automated build, you have the option of using Webhooks with it. You can use a webhook to cause an action in another application in response to an event in your automated build repository. Currently, your webhook fires when an image is built in, or a new tag added to, your automated build repository.

With your webhook, you specify a target URL and a JSON payload to deliver. The webhook below generates an HTTP POST that delivers a JSON payload:

{
  callback_url: https://registry.hub.docker.com/u/svendowideit/testhook/hook/2141b5bi5i5b02bec211i4eeih0242eg11000a/,
  push_data: {
    images: [
        27d47432a69bca5f2700e4dff7de0388ed65f9d3fb1ec645e2bc24c223dc1cc3,
        51a9c7c1f8bb2fa19bcd09789a34e63f35abb80044bc10196e304f6634cc582c,
        ...
    ],
    pushed_at: 1.417566161e+09,
    pusher: trustedbuilder
  },
  repository: {
    comment_count: 0,
    date_created: 1.417494799e+09,
    description: ,
    dockerfile: #\n# BUILD\u0009\u0009docker build -t svendowideit/apt-cacher .\n# RUN\u0009\u0009docker run -d -p 3142:3142 -name apt-cacher-run apt-cacher\n#\n# and then you can run containers with:\n# \u0009\u0009docker run -t -i -rm -e http_proxy http://192.168.1.2:3142/ debian bash\n#\nFROM\u0009\u0009ubuntu\nMAINTAINER\[email protected]\n\n\nVOLUME\u0009\u0009[\/var/cache/apt-cacher-ng\]\nRUN\u0009\u0009apt-get update ; apt-get install -yq apt-cacher-ng\n\nEXPOSE \u0009\u00093142\nCMD\u0009\u0009chmod 777 /var/cache/apt-cacher-ng ; /etc/init.d/apt-cacher-ng start ; tail -f /var/log/apt-cacher-ng/*\n,
    full_description: Docker Hub based automated build from a GitHub repo,
    is_official: false,
    is_private: true,
    is_trusted: true,
    name: testhook,
    namespace: svendowideit,
    owner: svendowideit,
    repo_name: svendowideit/testhook,
    repo_url: https://registry.hub.docker.com/u/svendowideit/testhook/,
    star_count: 0,
    status: Active
  }
}

Note: If you want to test your webhook, we recommend using a tool like requestb.in. Also note, the Docker Hub server can’t be filtered by IP address.

Chaining webhooks

Webhook chains allow you to chain calls to multiple services. For example, you can use a webhook chain to trigger a deployment of your container only after it passes testing, then update a separate change log once the deployment is complete. After clicking the Add webhook button, simply add as many URLs as necessary in your chain.

The first webhook in a chain is called after a successful push. Subsequent URLs is contacted after the callback is validated. You can find specific details on how to set up webhooks in the GitHub and Bitbucket documentation.

Validating a callback

To validate a callback in a webhook chain, you need to

  1. Retrieve the callback_url value in the request’s JSON payload.

  2. Send a POST request to this URL containing a valid JSON body.

Note: A chain request is only considered complete once the last callback is validated.

To help you debug or simply view the results of your webhook(s), view the History of the webhook available on its settings page.

Callback JSON data

The following is the JSON structure for the callback.

{
  state: success,
  description: 387 tests PASSED,
  context: Continuous integration by Acme CI,
  target_url: http://ci.acme.com/results/afd339c1c3d27
}
Parameter Description
state Required. Can contain the success, failure and error values. If the state isn’t success, the webhook chain is interrupted.
description A string containing miscellaneous information that is,available on the Docker Hub. Maximum 255 characters.
context A string containing the context of the operation. Can be retrieved,from the Docker Hub. Maximum 100 characters.
target_url The URL where the results of the operation can be found. Can be,retrieved on the Docker Hub.
Mar 5, 2016 at 2:08am (PST) { "docker/apidocs": { "ref": "master", "repos": [ "[email protected]:docker/dhe-deploy.git" ], "sha": "70ac255c88cde0ea6ecf3fcb812783dea7e09da6" }, "docker/cloud-api-docs": { "ref": "master", "repos": [ "[email protected]:docker/cloud-docs.git" ], "sha": "c0539949c40be9abb193271e46d2ea88196f122d" }, "docker/cloud-api-docs-layout": { "ref": "master", "repos": [ "[email protected]:docker/cloud-docs.git" ], "sha": "c0539949c40be9abb193271e46d2ea88196f122d" }, "docker/compose": { "ref": "docs", "repos": [ "[email protected]:docker/compose.git" ], "sha": "9da9555f10abe628e7742476af3f10bd89f68b75" }, "docker/docker": { "ref": "docs", "repos": [ "[email protected]:docker/docker.git" ], "sha": "0e63b073ac8f33335a4d4df3f2aa22120e0b7f43" }, "docker/docker-cloud": { "ref": "master", "repos": [ "[email protected]:docker/cloud-docs.git" ], "sha": "c0539949c40be9abb193271e46d2ea88196f122d" }, "docker/docker-hub": { "ref": "master", "repos": [ "[email protected]:docker/hub2-demo.git" ], "sha": "73ccb2d678ab0cd83067f0c7ef6f3923d750c7bd" }, "docker/docker-trusted-registry": { "ref": "master", "repos": [ "[email protected]:docker/dhe-deploy.git" ], "sha": "70ac255c88cde0ea6ecf3fcb812783dea7e09da6" }, "docker/docs-base": { "ref": "master", "repos": [ "[email protected]:docker/docs-base.git" ], "sha": "5a4cfac3c4d156eda45080c7dcdd2a4c41e08067" }, "docker/kitematic": { "ref": "docs", "repos": [ "[email protected]:docker/kitematic.git" ], "sha": "856a989d834f7fcbcb9bba687539fb159228f6b8" }, "docker/machine": { "ref": "docs", "repos": [ "[email protected]:docker/machine.git" ], "sha": "21edf30337dc5996b5d785ce54d68b4020242f57" }, "docker/notary": { "ref": "docs", "repos": [ "[email protected]:docker/notary.git" ], "sha": "dfeb51f54f2b0cdf20cb55427b7cc8ea2d1cdd0a" }, "docker/opensource": { "ref": "master", "repos": [ "[email protected]:docker/opensource.git" ], "sha": "b994cdd1f74b0aeb0b51fda1249a0c4c8efbf0d0" }, "docker/registry": { "ref": "master", "repos": [ "[email protected]:docker/distribution.git" ], "sha": "33c4a6522e9247913fa0a9a2d78ef9a7aa98465f" }, "docker/swarm": { "ref": "docs", "repos": [ "[email protected]:docker/swarm.git" ], "sha": "b43a2c21c4017726cd9cb17ef9b16f2eef6d1159" }, "docker/toolbox": { "ref": "master", "repos": [ "[email protected]:docker/toolbox.git" ], "sha": "de267d701f94035549ea03e68047d85534286f85" }, "docker/tutorials": { "ref": "master", "repos": [ "[email protected]:docker/tutorials.git" ], "sha": "7af2622fe68a30684d971e4bf3ca7988902e5e26" }, "docker/ucp": { "ref": "master", "repos": [ "[email protected]:docker/orca.git" ], "sha": "8cd10936a1e063b9be0d5c04de7311a1b2cb25cf" }, "docs.docker.com": { "ref": "refs/heads/v1.10-030316", "repos": [ "[email protected]:moxiegirl/docs.docker.com.git", "[email protected]:docker/docs.docker.com.git" ], "sha": "b43886e4078ce481b06b4cee5c922f5bcc5c629f" } }