APIs / Apps and media / Docker Hub
1 credit per call3 endpoints7 datapoints
Docker Hub API
Docker Hub API for image search, repository details with pulls and stars, and tags with sizes, digests and platforms as JSON. 1 credit per successful call.
{
"success": true,
"data": {
"total": 297082,
"page": 1,
"has_more": true,
"count": 10,
"items": [
{
"name": "nginx",
"description": "Official build of Nginx.",
"stars": 21438,
"pulls": 13654538231,
"official": true,
"automated": false,
"url": "https://hub.docker.com/_/nginx"
},
{
"name": "nginx/nginx-ingress",
"description": "NGINX and NGINX Plus Ingress Controllers for Kubernetes",
"stars": 124,
"pulls": 1089096520,
"official": false,
"automated": false,
"url": "https://hub.docker.com/r/nginx/nginx-ingress"
},
{
"name": "nginx/nginx-prometheus-exporter",
"description": "NGINX Prometheus Exporter for NGINX and NGINX Plus",
"stars": 53,
"pulls": 93031540,
"official": false,
"automated": false,
"url": "https://hub.docker.com/r/nginx/nginx-prometheus-exporter"
}
]
},
"meta": {
"request_id": "req_02a362a34484491da65821ecbf6e4996",
"credits_charged": 1,
"credits_remaining": 1996
}
}Sample data
What one call returns
A recorded run of search: the fields and shapes you will get, shortened to 3 items.
| # | namestring | descriptionstring | starsinteger | pullsinteger | officialboolean | automatedboolean | urlurl |
|---|---|---|---|---|---|---|---|
| 1 | nginx | Official build of Nginx. | 21438 | 13654538231 | true | false | https://hub.docker.com/_/nginx |
| 2 | nginx/nginx-ingress | NGINX and NGINX Plus Ingress Controllers for Kubernetes | 124 | 1089096520 | false | false | https://hub.docker.com/r/nginx/nginx-ingress |
| 3 | nginx/nginx-prometheus-exporter | NGINX Prometheus Exporter for NGINX and NGINX Plus | 53 | 93031540 | false | false | https://hub.docker.com/r/nginx/nginx-prometheus-exporter |
[
{
"name": "nginx",
"description": "Official build of Nginx.",
"stars": 21438,
"pulls": 13654538231,
"official": true,
"automated": false,
"url": "https://hub.docker.com/_/nginx"
},
{
"name": "nginx/nginx-ingress",
"description": "NGINX and NGINX Plus Ingress Controllers for Kubernetes",
"stars": 124,
"pulls": 1089096520,
"official": false,
"automated": false,
"url": "https://hub.docker.com/r/nginx/nginx-ingress"
},
{
"name": "nginx/nginx-prometheus-exporter",
"description": "NGINX Prometheus Exporter for NGINX and NGINX Plus",
"stars": 53,
"pulls": 93031540,
"official": false,
"automated": false,
"url": "https://hub.docker.com/r/nginx/nginx-prometheus-exporter"
}
]name,description,stars,pulls,official,automated,url nginx,Official build of Nginx.,21438,13654538231,true,false,https://hub.docker.com/_/nginx nginx/nginx-ingress,NGINX and NGINX Plus Ingress Controllers for Kubernetes,124,1089096520,false,false,https://hub.docker.com/r/nginx/nginx-ingress nginx/nginx-prometheus-exporter,NGINX Prometheus Exporter for NGINX and NGINX Plus,53,93031540,false,false,https://hub.docker.com/r/nginx/nginx-prometheus-exporter
Recorded from our API · 3 items shown · 7 datapoints per itemGET /v1/docker-hub/search?query=nginx&page_size=10
7 datapoints
Identity
- namestring
Contact
- urlurl
Reputation
- starsinteger
Other
- descriptionstring
- pullsinteger
- officialboolean
- automatedboolean
Playground
Run this API
curl "https://api.perceptlayer.com/v1/docker-hub/search?query=nginx&page_size=10" \
-H "X-API-Key: $API_KEY"Docker Hub · 3 endpoints
Endpoints
Every endpoint takes the same key. Open one for its parameters, the fields it returns and an example request.
| Endpoint | Required parameters | Returns | Cost |
|---|---|---|---|
GET/v1/docker-hub/repository | name | namenamespacedescriptionfull_descriptionstarspulls+6 more | 1 credit |
GET/v1/docker-hub/search | query+2 optional | namedescriptionstarspullsofficialautomated+1 more | 1 credit |
GET/v1/docker-hub/tags | name+3 optional | tagsize_bytesdigestlast_updatedlast_pushedplatforms | 1 credit |
Overview
About the Docker Hub API
What you can get
The Docker Hub API returns Docker Hub image repository data as JSON through 3 endpoints. Repositories are named namespace/name, or by a bare name for an official image.
- Search:
searchtakes aquery, withpageandpage_size(1 to 100). - Repositories:
repositorytakes aname, for examplebitnami/redisornginx. - Tags:
tagstakes aname, withordering(last_updated or name),pageandpage_size.
The recorded search for "nginx" returns items, each with name, description, stars, pulls, official, automated and url, plus total (297,082 in that recording), page and has_more. The first result, the official nginx image, had 21,438 stars and 13,654,538,231 pulls. repository adds namespace, full_description (the repository's readme), categories, last_updated, created_at and storage_bytes.
How a call works
Search, then look up: GET /v1/docker-hub/search?query=nginx&page_size=10 with your key in the X-API-Key header returns each repository's name; repository and tags take that name, for example GET /v1/docker-hub/tags?name=nginx&page_size=10. Check has_more before asking for the next page. Answers come from a cache for up to an hour, so pulls, stars and new tags can be up to an hour old. Every successful call costs 1 credit; failed calls cost nothing.
More apps and media APIs
Use cases
Check the newest tags of a base image before bumping a Dockerfile
Use the Docker Hub API to check the newest tags of a base image before bumping a DockerfileCheck which platforms a tag is built for, by `os` and `architecture`
Use the Docker Hub API to check which platforms a tag is built for, by `os` and `architecture`Compare candidate images by pulls, stars and whether they are official
Use the Docker Hub API to compare candidate images by pulls, stars and whether they are officialPin an image by digest from the tag list
Use the Docker Hub API to pin an image by digest from the tag listFAQ
Questions
How much does the Docker Hub API cost?
Each successful call costs one credit, and each page of results or tags is one call. New accounts get free credits to start, and credit packs bring the price down as you scale.
How do I name an official image?
Pass the bare name, such as `nginx`; it is returned as `library/nginx`. Other repositories take namespace/name, such as `bitnami/redis`.
What does `tags` return?
Each tag's `tag`, `size_bytes`, `digest`, `last_updated`, `last_pushed` and `platforms`, each platform with `os`, `architecture`, `size_bytes` and `digest`, plus a `total` (1,437 tags for `nginx` in the recording). It does not return image layers or vulnerability scans.
Do I need a Docker Hub account?
No. You call this Docker Hub API with your Perceptlayer key in the `X-API-Key` header, with no Docker Hub login or token.
Should I build a Docker Hub scraper instead?
You can, but a Docker Hub scraper is code you maintain: page changes break it, requests get blocked, and Docker Hub's terms govern how you collect data. The Docker Hub API gives you 3 endpoints of named JSON fields for 1 credit per successful call, and failed calls cost nothing. A scraper makes sense only for data these endpoints don't return, so check the response in the playground on this page first.
Try the Docker Hub API with 100 free credits
No credit card. Failed calls are never billed.