All connectors
Docker Hub
Official
Docker Hub
Let agents browse public image repositories and tags, inspect digests, supported platforms, sizes and push dates, and compare image variants.
Access is read-only and anonymous. Private repositories, organization/team administration and Docker Scout vulnerability reports are unavailable.
Request quotas are shared across Houston users. This connector is not affiliated with Docker.
Setup instructions
Setup instructions
Add Docker Hub
Select Add connection in Houston. No account, token or settings are required.
This connector reads public data only. Private repositories, organizations and teams are unavailable.
Advanced
Official images use the library namespace. Anonymous lists stop after 100
repositories or 1,000 tags; narrow by name when needed.
Files
Files
connector.luau
-- Docker Hub API v2 (https://docs.docker.com/reference/api/hub/latest/), read anonymously. Arguments and results keep Docker Hub's native field names. type Options = {[string]: any} type Endpoint = {method: string, path: string, query: {string}?, extra: {string}?, required: {string}?, access: string?, body: (boolean | string)?, reach: number?, doc: string, about: string} local PROVIDER = "Docker Hub" local DOCS = "https://docs.docker.com/reference/api/hub/latest/#tag/repositories/operation/" local API = "https://hub.docker.com/v2" -- The reads of Docker Hub's OpenAPI (docs.docker.com/reference/api/hub/latest.yaml), checked on 2026-10-30, that answer -- without signing in. Path {fields} are required; tags' name filter is the one Docker Hub's website uses, outside the -- published schema. Lists answer with one page; reach is how many items Docker Hub lists without signing in (probed then). local endpoints: {[string]: Endpoint} = { listRepositories = {method = "GET", path = "/namespaces/{namespace}/repositories", query = {"name", "ordering", "page", "page_size"}, reach = 100, doc = "listNamespaceRepositories", about = "A namespace's public repositories: {count, next, previous, results}, each {name, namespace, repository_type, status_description, description, is_private, star_count, pull_count, last_updated (last push), last_modified, date_registered, media_types, content_types, categories: [{name, slug}], storage_size (bytes), registry_region}. name keeps repositories whose name contains it. ordering: name or -name (A to Z, Z to A), last_updated (newest push first) or -last_updated, pull_count (most pulled first) or -pull_count; Docker Hub's reference documents these last two pairs the other way round. Without ordering, the earliest registered come first. A namespace that doesn't exist, or has no public repository, answers count 0."}, getRepository = {method = "GET", path = "/namespaces/{namespace}/repositories/{repository}", doc = "GetRepository", about = "A public repository: {name, namespace, user, hub_user, repository_type, status_description, description, full_description (the repository overview in Markdown, up to 25,000 characters), is_private, is_automated, star_count, pull_count, last_updated (last push), last_modified, date_registered, collaborator_count, has_starred, permissions {read, write, admin}, media_types, content_types, categories, immutable_tags_settings {enabled, rules}, storage_size (bytes), source}."}, listTags = {method = "GET", path = "/namespaces/{namespace}/repositories/{repository}/tags", query = {"name", "page", "page_size"}, reach = 1000, doc = "ListRepositoryTags", about = "A public repository's tags, most recently pushed first: {count, next, previous, results}, each as in getTag. name keeps tags whose name contains it, such as 'alpine' or '1.27'."}, getTag = {method = "GET", path = "/namespaces/{namespace}/repositories/{repository}/tags/{tag}", doc = "GetRepositoryTag", about = "A tag: {name, digest (what docker pull resolves: the image index of a multi-platform tag, else its single manifest), media_type, content_type, full_size, tag_status (active or inactive), tag_last_pushed, tag_last_pulled, last_updated, last_updater_username, id, repository, images}. images (null for some old tags) has one manifest per platform: {architecture, os, variant, os_version, digest, size, status, last_pushed, last_pulled}; entries whose architecture and os are 'unknown' are build attestations, such as provenance and SBOMs, not runnable images. full_size is one platform's size, not the sum, and can be 0 for old tags."}, } -- Request layer shared verbatim by the endpoint-table connectors -- (tools/validate checks they match). It uses each connector's PROVIDER, DOCS and Endpoint type. local NULL = json.decode("null") local NONE: {string} = table.freeze({}) local function options(input: Options?): Options if input == nil then return {} end assert(type(input) == "table", "opts must be an object") for key in input do assert(type(key) == "string", "opts must have named fields") end return table.clone(input) end local function scalar(value: any, field: string): string local kind = type(value) assert(kind == "string" or kind == "boolean" or kind == "number", field .. " must be a string, boolean, number or array of those") return url.encode(value) end -- A query value's encoded parts: one for a scalar, one per item of a nonempty array. Each -- connector joins them as its provider expects, comma-separated or with the key repeated. local function queryParts(value: any, field: string): {string} if type(value) ~= "table" then return {scalar(value, field)} end local parts: {string} = {} for index, item in value do assert(type(index) == "number" and index == #parts + 1, field .. " must be an array, not an object") table.insert(parts, scalar(item, field)) end assert(#parts > 0, field .. " must not be an empty array") return parts end -- POST, PATCH and PUT send the remaining options as the JSON body unless body is false -- (no body) or names the one option to send. local function hasBody(endpoint: Endpoint): boolean return endpoint.body ~= false and (endpoint.method == "POST" or endpoint.method == "PATCH" or endpoint.method == "PUT") end local function fail(name: string, response: HttpResponse, message: string): never return houston.fail({operation = name, layer = "upstream", upstream_status = response.statusCode, retryable = response.statusCode == 429 or response.statusCode >= 500, message = message}) end -- A successful response's JSON object, or nil when a write answers without a body. With arrays, -- a top-level JSON array is accepted too, and the second result tells which one came back. local function object(name: string, endpoint: Endpoint, response: HttpResponse, arrays: boolean?): (any, boolean) local raw = await(response.body:readAll()) if endpoint.method ~= "GET" and endpoint.access and string.match(raw, "^%s*$") then return nil, false end local ok, value = pcall(json.decode, raw) local list = arrays == true and string.match(raw, "^%s*%[") ~= nil if not ok or type(value) ~= "table" or not (list or string.match(raw, "^%s*{")) then fail(name, response, PROVIDER .. " returned an invalid JSON object") end return value, list end -- name({path fields, query fields?, extra fields?, required body fields, ...body}) built from the -- endpoint itself. -- Extra fields are options the connector's own request consumes, such as a request header. local function signature(endpoint: Endpoint): string local fields: {string} = {} for field in string.gmatch(endpoint.path, "{([%w_]+)}") do table.insert(fields, field) end for _, group in {endpoint.query or NONE, endpoint.extra or NONE} do for _, field in group do table.insert(fields, if table.find(endpoint.required or NONE, field) then field else field .. "?") end end if type(endpoint.body) == "string" then table.insert(fields, endpoint.body) elseif hasBody(endpoint) then for _, field in endpoint.required or NONE do if not table.find(fields, field) then table.insert(fields, field) end end table.insert(fields, "...body") end return "({" .. table.concat(fields, ", ") .. "})" end -- A function for each endpoint the connection's access allows, and help listing them after intro. local function operations(endpoints: {[string]: Endpoint}, request: (string, Endpoint, Options?) -> any, intro: {string}): {[string]: any} local exports: {[string]: any} = {} for name, endpoint in endpoints do if not endpoint.access or houston.allows(endpoint.access) then exports[name] = function(args: Options?): any return request(name, endpoint, args) end end end exports.help = function(): string local names: {string} = {} for name in exports do if name ~= "help" then table.insert(names, name) end end table.sort(names) local lines = table.clone(intro) table.insert(lines, "Each function below names its route and reference page, " .. DOCS .. "<page>.") for _, name in names do local endpoint = endpoints[name] table.insert(lines, name .. signature(endpoint) .. ": " .. endpoint.about .. " " .. endpoint.method .. " " .. endpoint.path .. " (" .. endpoint.doc .. ")") end return table.concat(lines, "\n") end return exports end -- End of the shared request layer. -- Docker Hub's naming rules, so an argument can't add path segments or reach another route. local SEGMENTS: {[string]: {pattern: string, max: number, about: string}} = { namespace = {pattern = "^[%l%d][%l%d._%-]*$", max = 255, about = "a Docker Hub user or organization name in lowercase, such as library or bitnami"}, repository = {pattern = "^[%l%d][%l%d._%-]*$", max = 255, about = "a repository name in lowercase, such as nginx"}, tag = {pattern = "^[%w_][%w_.%-]*$", max = 128, about = "a tag such as latest or 1.27-alpine"}, } local ORDERINGS = {"name", "-name", "last_updated", "-last_updated", "pull_count", "-pull_count"} local REACH = "Houston reads Docker Hub without signing in, so lists stop after the first 100 repositories or 1,000 tags; narrow the list with name" -- Houston ends a call after 30 s and the sandbox has no clock. Headers get 15 s, leaving the rest for a 200 body (read by -- the shared layer without a deadline; the largest page is about 470 KB) and Houston's short 429 waits; an error body gets 7 s. local HEADERS_TIME, BODY_TIME = 15000, 7000 local function integer(value: any, field: string, max: number): string assert(type(value) == "number" and value == math.floor(value) and value >= 1 and value <= max, field .. " must be an integer from 1 to " .. tostring(max)) return string.format("%d", value) end -- A page can't start beyond reach, and reach caps page too, with a page_size of 1. local function queryValue(field: string, value: any, reach: number): string if field == "page" then return integer(value, field, reach) end if field == "page_size" then return integer(value, field, 100) end if field == "ordering" then assert(type(value) == "string" and table.find(ORDERINGS, value), "ordering must be one of " .. table.concat(ORDERINGS, ", ")) return value end assert(type(value) == "string" and string.find(value, "%S") and #value <= 255, field .. " must be a nonempty string of at most 255 bytes") return url.encode(value) end -- Docker Hub errors are {message, errinfo}, or {text, fields} in older routes; rate limits add Retry-After in seconds. local function failStatus(name: string, response: HttpResponse): never local status = response.statusCode local message = PROVIDER .. " HTTP " .. tostring(status) if status >= 300 and status < 400 then response.body:close() return fail(name, response, message .. ": unexpected redirect") end -- An error body that stalls or breaks counts as empty, so the status and retryable survive. local read, raw: any = pcall(function() return await(response.body:readPrefix(4096), BODY_TIME) end) if not read and type(raw) == "table" and raw.code == "cancelled" then error(raw, 0) end local ok, value = false, nil if read then ok, value = pcall(json.decode, raw) end local detail = if ok and type(value) == "table" and type(value.message) == "string" then value.message elseif ok and type(value) == "table" and type(value.text) == "string" then value.text else nil if detail then message ..= ": " .. string.sub(detail, 1, 300) end if status == 403 and detail and string.find(detail, "pagination offset", 1, true) then message ..= ". " .. REACH elseif status == 404 and detail == "object not found" then message ..= ". The repository doesn't exist or is private, and Houston reads public repositories only" end local retry = response.headers["retry-after"] if (status == 429 or status == 503) and retry and retry[1] then local wait = string.sub(retry[1], 1, 32) message ..= "; retry after " .. wait .. (if string.match(wait, "^%d+$") then "s" else "") end return fail(name, response, message) end local function request(name: string, endpoint: Endpoint, input: Options?): any local args = options(input) local path = string.gsub(endpoint.path, "{([%w_]+)}", function(field: string): string local value, rule = args[field], SEGMENTS[field] args[field] = nil assert(type(value) == "string" and #value <= rule.max and string.match(value, rule.pattern), field .. " must be " .. rule.about) return value end) local query: {string} = {} -- Docker Hub's defaults, for the offset check below. local paging: {[string]: number} = {page = 1, page_size = 10} for _, field in endpoint.query or NONE do local value = args[field] args[field] = nil if value ~= nil and value ~= NULL then table.insert(query, field .. "=" .. queryValue(field, value, endpoint.reach or 1)) if paging[field] then paging[field] = value end end end local unknown = next(args) assert(unknown == nil, name .. " has no option " .. string.sub(tostring(unknown), 1, 64)) assert(endpoint.reach == nil or (paging.page - 1) * paging.page_size < endpoint.reach, name .. ": " .. REACH) if #query > 0 then path ..= "?" .. table.concat(query, "&") end local sent, result: any = pcall(function() return await(http.request({method = "GET", url = API .. path, headers = {Accept = {"application/json"}}, timeoutMs = HEADERS_TIME})) end) if not sent then if type(result) == "table" and result.code == "timeout" then houston.fail({operation = name, layer = "upstream", retryable = true, message = PROVIDER .. " did not answer within " .. tostring(HEADERS_TIME // 1000) .. " s; retry"}) end error(result, 0) end local response: HttpResponse = result if response.statusCode ~= 200 then failStatus(name, response) end local value = object(name, endpoint, response) if endpoint.query and type(value.results) ~= "table" then fail(name, response, PROVIDER .. " returned an invalid list") end return value end local intro = { "Docker Hub API v2 on " .. API .. ", read anonymously: public repositories and their tags only. Docker Hub accepts access tokens only after exchanging them for a short-lived session token, which Houston connectors can't do yet, so this connection holds no Docker credential. Private repositories answer HTTP 404 as if they didn't exist, organizations, teams and members can't be read, and nothing can be changed: no repository descriptions, no tag deletion, no Docker Scout vulnerability reports.", "Every function takes one named options object with Docker Hub's native names; ? marks optional fields. Results are Docker Hub's JSON unchanged. Connector calls return completed values: use them directly, without await.", "namespace is a user or organization, such as bitnami or docker. Docker Official Images, such as nginx, python or postgres, are in the namespace library. An image reference such as bitnami/redis:7.4 is namespace bitnami, repository redis and tag 7.4; one without a slash, such as nginx:latest, is in library. Names are lowercase.", "Lists return one page, {count, next, previous, results}. page starts at 1; page_size is 1 to 100, 10 by default. next is null on the last page, else the URL of the following one: call again with page + 1 and the same options. JSON null is truthy in Luau, so test type(page.next) == 'string'. Without signing in, Docker Hub lists only the first 100 repositories and the first 1,000 tags, though count and next go on: stop there, since a page starting beyond fails before any request. Narrow long lists with name.", "Times are ISO 8601 in UTC; sizes are compressed bytes. Example: local page = dockerhub.listTags({namespace='library', repository='nginx', name='alpine', page_size=25}); for _, t in page.results do print(t.name, t.digest, t.tag_last_pushed) end; local tag = dockerhub.getTag({namespace='library', repository='nginx', tag='latest'}); local repo = dockerhub.getRepository({namespace='bitnami', repository='redis'}).", "Docker Hub allows 180 requests per minute per IP address, and every Houston connection shares Houston's addresses. Houston retries an HTTP 429 at most twice, waiting as Retry-After asks when that is 5 s or less, or 1 s and then 2 s without a readable one; a longer wait or a third 429 fails as retryable, with the wait. Errors report the HTTP status and Docker Hub's message; 429, 5xx and a Docker Hub that doesn't answer within " .. tostring(HEADERS_TIME // 1000) .. " s are retryable. This connection is read-only.", } return operations(endpoints, request, intro)houston.json
{ "schema_version": 2, "name": "Docker Hub", "files": [ "connector.luau" ], "icon": "icon.svg", "proxy": [ { "match": { "protocol": "http", "host": [ "hub.docker.com" ], "method": [ "GET" ], "path": [ "/v2/namespaces/{namespace}/repositories", "/v2/namespaces/{namespace}/repositories/{repository}", "/v2/namespaces/{namespace}/repositories/{repository}/tags", "/v2/namespaces/{namespace}/repositories/{repository}/tags/{tag}" ] }, "action": { "headers": { "remove": [ "Authorization", "Cookie" ] } } } ] }icon.svg
README.md
--- description: Read public Docker Hub repositories and image tags, with their digests, platforms, sizes and push dates. --- # Docker Hub Let agents browse public image repositories and tags, inspect digests, supported platforms, sizes and push dates, and compare image variants. > Access is read-only and anonymous. Private repositories, organization/team > administration and Docker Scout vulnerability reports are unavailable. Request quotas are shared across Houston users. This connector is not affiliated with Docker. [Add Docker Hub](SETUP.md).SETUP.md
# Add Docker Hub Select **Add connection** in Houston. No account, token or settings are required. > This connector reads public data only. Private repositories, organizations and > teams are unavailable. ## Advanced Official images use the `library` namespace. Anonymous lists stop after 100 repositories or 1,000 tags; narrow by name when needed. [Docker Hub API guide](https://docs.docker.com/reference/api/hub/latest/).tests
authentication.luau
return { contract = function(m) m.authentication({ { auth = {}, config = {}, endpoint = { "GET", "https://hub.docker.com/v2/namespaces/library/repositories/nginx/tags", }, expected = "", header = "Authorization", method = "", publisher = {}, }, }) end, }endpoints.luau
return { contract = function(m) local prefix = assert(string.match(m.modules["connector.luau"], 'local API = "https://hub%.docker%.com([^"]*)"')) local want = {} for _, entry in m.endpoints() do assert(not entry.write, "anonymous endpoint writes") table.insert(want, prefix .. entry.path) end assert(#m.raw.proxy == 1 and m.equal(m.raw.proxy[1].match.method, { "GET" }), "expected one GET rule") m.sortedEqual(want, m.concat(m.raw.proxy[1].match.path)) end, }errors.luau
-- Invalid input never reaches Docker Hub, and its errors and bad bodies map to clear failures. return { scenario = {publisher = {}, config = {}, auth_method = "", auth_config = {}}, configure = function() calls = 0 status, payload, responseHeaders = 200, "{}", {} http = {request = function(req) calls += 1 if requestError then error(requestError, 0) end assert(string.sub(req.url, 1, 26) == "https://hub.docker.com/v2/", req.url) -- A body whose read fails stands in for a stalled or dropped error body. local body = if readError then {readAll = function() error(readError, 0) end, readPrefix = function() error(readError, 0) end, close = function() end} else fixture.reader(payload) return fixture.operation({statusCode = status, headers = responseHeaders, body = body}) end} end, run = function(dockerhub) local function rejected(fn, expected) local before = calls local ok, err = pcall(fn) assert(not ok and string.find(tostring(err), expected, 1, true), "wrong validation error: " .. tostring(err)) assert(calls == before, "invalid input reached Docker Hub") end local function repo(opts) return function() dockerhub.getRepository(opts) end end local function tags(opts) return function() opts.namespace, opts.repository = "library", "nginx" dockerhub.listTags(opts) end end for _, namespace in {"", "Library", "-x", "_x", ".x", "a/b", ".", "..", "%2e%2e", "lib rary", string.rep("a", 256), 42, {"library"}} do rejected(repo({namespace = namespace, repository = "nginx"}), "namespace must be a Docker Hub user or organization name in lowercase") end for _, repository in {"", "Nginx", ".", "..", ".nginx", "-nginx", "nginx/tags", "nginx?x=1", "nginx%2F", "ngi nx", string.rep("n", 256)} do rejected(repo({namespace = "library", repository = repository}), "repository must be a repository name in lowercase") end for _, tag in {"", ".", "..", ".latest", "-latest", "a/b", "a:b", "a b", "a%2F", string.rep("t", 129), 1} do rejected(function() dockerhub.getTag({namespace = "library", repository = "nginx", tag = tag}) end, "tag must be a tag such as latest") end rejected(repo({repository = "nginx"}), "namespace must be") rejected(function() dockerhub.listRepositories() end, "namespace must be") rejected(function() dockerhub.listRepositories("docker") end, "opts must be an object") rejected(function() dockerhub.listRepositories({"docker"}) end, "opts must have named fields") rejected(repo({namespace = "library", repository = "nginx", page = 1}), "getRepository has no option page") rejected(function() dockerhub.listRepositories({namespace = "docker", ordering = "stars"}) end, "ordering must be one of name, -name, last_updated, -last_updated, pull_count, -pull_count") rejected(function() dockerhub.listRepositories({namespace = "docker", ordering = {"name"}}) end, "ordering must be one of") -- Tags can't be ordered: Docker Hub's undocumented ordering sorts names backwards. rejected(tags({ordering = "name"}), "listTags has no option ordering") for _, value in {0, -1, 1.5, "2", 1001} do rejected(tags({page = value}), "page must be an integer from 1 to 1000") end rejected(function() dockerhub.listRepositories({namespace = "docker", page = 101, page_size = 1}) end, "page must be an integer from 1 to 100") for _, value in {0, 101, 2.5, "10"} do rejected(tags({page_size = value}), "page_size must be an integer from 1 to 100") end for _, value in {"", " ", string.rep("x", 256), 5, {"alpine"}} do rejected(tags({name = value}), "name must be a nonempty string of at most 255 bytes") end -- A next URL is not a page number, so another route can't be smuggled in. rejected(tags({page = "https://hub.docker.com/v2/orgs/docker/members?page=2"}), "page must be an integer") rejected(tags({next = "https://hub.docker.com/v2/namespaces/library/repositories/nginx/tags?page=2"}), "listTags has no option next") -- Pages beyond what Docker Hub lists without signing in fail before any request, with Docker Hub's default page size of 10. local reach = "Houston reads Docker Hub without signing in, so lists stop after the first 100 repositories or 1,000 tags" rejected(function() dockerhub.listRepositories({namespace = "docker", page = 11}) end, "listRepositories: " .. reach) rejected(function() dockerhub.listRepositories({namespace = "docker", page = 2, page_size = 100}) end, "listRepositories: " .. reach) rejected(tags({page = 101}), "listTags: " .. reach) rejected(tags({page = 11, page_size = 100}), "listTags: " .. reach) local function upstream(code, body, headers, expected, absent, call) status, payload, responseHeaders = code, body, headers local before = calls local ok, err = pcall(call or repo({namespace = "library", repository = "nginx"})) for _, text in expected do assert(not ok and string.find(tostring(err), text, 1, true), "missing " .. text .. " in " .. tostring(err)) end if absent then assert(not string.find(tostring(err), absent, 1, true), "unexpected " .. absent .. " in " .. tostring(err)) end assert(calls == before + 1, "a failed request was repeated") end upstream(404, '{"message":"object not found","errinfo":{}}', {}, {"Docker Hub HTTP 404: object not found. The repository doesn't exist or is private", '"retryable":false', '"upstream_status":404'}) upstream(404, '{"message":"httperror 404: tag \'nope\' not found","errinfo":{"namespace":"library","repository":"nginx","tag":"nope"}}', {}, {"Docker Hub HTTP 404: httperror 404: tag 'nope' not found", '"retryable":false'}, "private") -- Should Docker Hub lower its cap, its refusal still gets the hint. upstream(403, '{"message":"pagination offset too large for anonymous requests; sign in to page further","errinfo":{}}', {}, {"Docker Hub HTTP 403: pagination offset too large", "lists stop after the first 100 repositories or 1,000 tags; narrow the list with name", '"retryable":false', '"upstream_status":403'}, nil, tags({page = 100, page_size = 10})) upstream(403, '{"message":"forbidden","errinfo":null}', {}, {"Docker Hub HTTP 403: forbidden", '"retryable":false'}, "narrow") upstream(400, '{"message":"httperror 400: Invalid ordering value","errinfo":{"ordering":"bad"}}', {}, {"Docker Hub HTTP 400: httperror 400: Invalid ordering value", '"retryable":false'}) upstream(400, '{"fields":{"ordering":["Invalid"]},"text":"Invalid ordering value"}', {}, {"Docker Hub HTTP 400: Invalid ordering value"}) upstream(400, json.encode({message = string.rep("y", 1000)}), {}, {"Docker Hub HTTP 400: " .. string.rep("y", 300)}, string.rep("y", 301)) upstream(401, '{"message":"unauthorized","errinfo":{}}', {}, {"Docker Hub HTTP 401: unauthorized", '"retryable":false'}) upstream(429, '{"message":"rate limit exceeded"}', {["retry-after"] = {"42"}, ["x-ratelimit-reset"] = {"1793385363"}}, {"Docker Hub HTTP 429: rate limit exceeded; retry after 42s", '"retryable":true', '"upstream_status":429'}) upstream(429, "", {["retry-after"] = {"Fri, 30 Oct 2026 19:00:00 GMT"}}, {"Docker Hub HTTP 429; retry after Fri, 30 Oct 2026 19:00:00 GMT", '"retryable":true'}, "GMTs") upstream(429, "", {}, {"Docker Hub HTTP 429", '"retryable":true'}, "retry after") upstream(503, "<html>Service Unavailable</html>", {}, {"Docker Hub HTTP 503", '"retryable":true'}, "Service") upstream(500, '{"message":null,"errinfo":null}', {}, {"Docker Hub HTTP 500", '"retryable":true'}) upstream(301, "", {location = {"https://elsewhere.example.com/v2/"}}, {"Docker Hub HTTP 301: unexpected redirect", '"retryable":false'}, "elsewhere") upstream(200, "<html>maintenance</html>", {}, {"Docker Hub returned an invalid JSON object", '"retryable":false'}, "maintenance") upstream(200, "[]", {}, {"Docker Hub returned an invalid JSON object"}) status, payload, responseHeaders = 200, '{"count":1,"next":null,"previous":null,"results":null}', {} local ok, err = pcall(tags({})) assert(not ok and string.find(tostring(err), "Docker Hub returned an invalid list", 1, true), tostring(err)) requestError = {code = "timeout", message = "request deadline"} upstream(200, "", {}, {"Docker Hub did not answer within 15 s; retry", '"retryable":true'}) -- Other request failures pass through unchanged, message included, and never become an upstream failure. requestError = {code = "access_denied", message = "origin not allowed"} upstream(200, "", {}, {"origin not allowed"}, "retryable") requestError = nil -- An error body that stalls or breaks still gives the structured failure, with Retry-After on a 503. readError = {code = "timeout", message = "await timed out"} upstream(503, "", {["retry-after"] = {"30"}}, {"Docker Hub HTTP 503; retry after 30s", '"retryable":true', '"upstream_status":503'}, "timed out") readError = {code = "io_error", message = "connection reset by peer"} upstream(404, "", {}, {"Docker Hub HTTP 404", '"retryable":false'}, "reset") readError = nil end, }manifest.luau
return { contract = function(m) local dockerhubManifest = "../../connectors/dockerhub/houston.json" -- TestDockerHubPublicRoutes do local r, err = m.resolve(nil, nil, nil, "") assert(not err, tostring(err)) local api = "https://hub.docker.com/v2" local nginx = api .. "/namespaces/library/repositories/nginx" m.routes(r, "", true, { "GET " .. api .. "/namespaces/docker/repositories?name=desk&ordering=-pull_count&page=2&page_size=100", "GET " .. nginx, "GET " .. nginx .. "/tags?name=alpine&page=3", "GET " .. nginx .. "/tags/latest", "GET " .. api .. "/namespaces/bitnami/repositories/redis/tags/7.4.2-debian-12-r0", }) m.routes(r, "", false, { "HEAD " .. nginx, "HEAD " .. nginx .. "/tags/latest", "DELETE " .. nginx .. "/tags/latest", "PATCH " .. nginx, "POST " .. api .. "/namespaces/docker/repositories", "PATCH " .. nginx .. "/immutabletags", "POST " .. nginx .. "/immutabletags/verify", "GET " .. nginx .. "/tags/", "POST " .. api .. "/auth/token", "POST " .. api .. "/users/login", "POST " .. api .. "/users/2fa-login", "GET " .. api .. "/access-tokens", "GET " .. api .. "/user/", "GET " .. api .. "/user/orgs/", "GET " .. api .. "/orgs/docker/members", "GET " .. api .. "/orgs/docker/groups", "GET " .. api .. "/orgs/docker/access-tokens", "GET " .. api .. "/auditlogs/docker", "GET " .. api .. "/scim/2.0/Users", "GET " .. api .. "/repositories/library/nginx/", "DELETE " .. api .. "/repositories/library/nginx/tags/latest/", "PATCH " .. api .. "/repositories/library/nginx/", "GET " .. api .. "/search/repositories/?query=nginx", "GET " .. api .. "/namespaces/library/repositories/%2e%2e/tags", "GET " .. api .. "/namespaces/library%2Fnginx/repositories", "GET https://registry-1.docker.io/v2/library/nginx/tags/list", "GET https://auth.docker.io/token?service=registry.docker.io", "GET https://api.scout.docker.com/v1/repositories", "GET https://hub.docker.com.example.com/v2/namespaces/docker/repositories", "GET https://docker.com/v2/namespaces/docker/repositories", "GET http://hub.docker.com:8080/v2/namespaces/docker/repositories", }) end end, }reads.luau
-- Each export reads one exact public URL without a credential and returns Docker Hub's JSON unchanged, nulls included. return { scenario = {publisher = {}, config = {}, auth_method = "", auth_config = {}}, configure = function() requests, responses = {}, {} http = {request = function(req) table.insert(requests, req) assert(req.method == "GET" and req.body == nil, "every request is a GET without a body") assert(req.headers.Accept[1] == "application/json" and req.headers.Authorization == nil, "Docker Hub is read without a credential") assert(req.timeoutMs == 15000, "headers get 15 s of the call") assert(#responses > 0, "unexpected request: " .. req.url) return fixture.operation({statusCode = 200, headers = {}, body = fixture.reader(table.remove(responses, 1))}) end} function respond(body) table.insert(responses, body) end end, run = function(dockerhub) local API = "https://hub.docker.com/v2" local NULL = json.decode("null") local function got(path) local req = requests[#requests] assert(req.url == API .. path, req.url) end local names = {} for name, fn in dockerhub do assert(type(fn) == "function") table.insert(names, name) end table.sort(names) assert(table.concat(names, ",") == "getRepository,getTag,listRepositories,listTags", table.concat(names, ",")) assert(#requests == 0, "initialization reached Docker Hub") -- A namespace's first page, with the next page's URL left as Docker Hub sent it. respond('{"count":420,"next":"https://hub.docker.com/v2/namespaces/docker/repositories?page=2&page_size=2","previous":null,' .. '"results":[{"name":"highland_builder","namespace":"docker","repository_type":"image","status":1,"status_description":"active",' .. '"description":"Image for performing Docker build requests","is_private":false,"star_count":7,"pull_count":19263991,' .. '"last_updated":"2026-10-22T18:51:12.424492Z","date_registered":"2015-05-19T21:13:35.937763Z","affiliation":"",' .. '"media_types":["application/vnd.oci.image.index.v1+json"],"categories":[{"name":"Operating systems","slug":"operating-systems"}],' .. '"storage_size":489508503351,"source":null,"registry_region":{"name":"us-east-1","label":"US"}},' .. '{"name":"whalesay","namespace":"docker","repository_type":null,"pull_count":145616122,"categories":[],"storage_size":103666708}]}') local page = dockerhub.listRepositories({namespace = "docker", page_size = 2}) got("/namespaces/docker/repositories?page_size=2") assert(page.count == 420 and #page.results == 2 and page.previous == NULL and page.next == "https://hub.docker.com/v2/namespaces/docker/repositories?page=2&page_size=2") assert(page.results[1].storage_size == 489508503351 and page.results[1].source == NULL and page.results[2].repository_type == NULL) assert(json.encode(page.results[2].categories) == "[]") -- Every option, in the endpoint's order; the filter is percent-encoded. respond('{"count":0,"next":null,"previous":null,"results":[]}') local empty = dockerhub.listRepositories({namespace = "bitnami", name = "redis cluster", ordering = "-pull_count", page = 2, page_size = 50}) got("/namespaces/bitnami/repositories?name=redis%20cluster&ordering=-pull_count&page=2&page_size=50") assert(empty.count == 0 and empty.next == NULL and json.encode(empty.results) == "[]") -- JSON null options are left out. respond('{"count":0,"next":null,"previous":null,"results":[]}') dockerhub.listRepositories({namespace = "ai", name = NULL, ordering = NULL}) got("/namespaces/ai/repositories") -- The last pages Docker Hub lists without signing in, and a namespace with a dot. respond('{"count":420,"next":"https://hub.docker.com/v2/namespaces/docker/repositories?page=11","previous":null,"results":[]}') dockerhub.listRepositories({namespace = "docker", page = 10}) got("/namespaces/docker/repositories?page=10") respond('{"count":1381,"next":null,"previous":null,"results":[]}') dockerhub.listTags({namespace = "library", repository = "nginx", page = 1000, page_size = 1}) got("/namespaces/library/repositories/nginx/tags?page=1000&page_size=1") respond('{"count":0,"next":null,"previous":null,"results":[]}') dockerhub.listRepositories({namespace = "a.b"}) got("/namespaces/a.b/repositories") respond('{"user":"library","name":"nginx","namespace":"library","repository_type":"image","description":"Official build of Nginx.",' .. '"is_private":false,"star_count":21414,"pull_count":13533095179,"last_updated":"2026-10-29T01:52:06.381447Z","affiliation":null,' .. '"hub_user":"stackbrew","full_description":"# Quick reference\\n","permissions":{"read":true,"write":false,"admin":false},' .. '"immutable_tags_settings":{"enabled":false,"rules":[".*"]},"storage_size":258813768582,"source":null}') local repo = dockerhub.getRepository({namespace = "library", repository = "nginx"}) got("/namespaces/library/repositories/nginx") assert(repo.pull_count == 13533095179 and repo.affiliation == NULL and repo.full_description == "# Quick reference\n") assert(repo.immutable_tags_settings.rules[1] == ".*") respond('{"name":"docker-model-backend-vllm","namespace":"docker"}') dockerhub.getRepository({namespace = "docker", repository = "docker-model-backend-vllm"}) got("/namespaces/docker/repositories/docker-model-backend-vllm") respond('{"name":"v1.10-migrator","namespace":"docker"}') dockerhub.getRepository({namespace = "docker", repository = "v1.10-migrator"}) got("/namespaces/docker/repositories/v1.10-migrator") -- Tags with their per-platform images; attestations and nulls come back unchanged. local tag = '{"creator":7,"id":19451,"images":[{"architecture":"amd64","features":"","variant":null,' .. '"digest":"sha256:8e0328743c8e52ead9fac9c198d0893d63cd38e41b1d9ea629e092a8ac229a93","os":"linux","os_features":"","os_version":null,' .. '"size":63911306,"status":"active","last_pulled":"2026-10-30T18:20:12.533304581Z","last_pushed":"2026-10-28T04:50:26.757399428Z"},' .. '{"architecture":"unknown","variant":null,"digest":"sha256:' .. string.rep("ab", 32) .. '","os":"unknown","size":2891767,"status":"active"}],' .. '"last_updated":"2026-10-28T04:53:32.454364Z","last_updater_username":"doijanky","name":"latest","repository":21171,"full_size":63911306,' .. '"v2":true,"tag_status":"active","tag_last_pulled":"2026-10-30T18:30:07.204630028Z","tag_last_pushed":"2026-10-28T04:53:32.454364Z",' .. '"media_type":"application/vnd.oci.image.index.v1+json","content_type":"image",' .. '"digest":"sha256:600f7cd45e27aa13e9304c834ab7c1b0ff39df85ee1dcc5087955455d77bc83b"}' respond('{"count":795,"next":"https://hub.docker.com/v2/namespaces/library/repositories/nginx/tags?name=alpine&page=2&page_size=1",' .. '"previous":null,"results":[' .. tag .. ']}') local tags = dockerhub.listTags({namespace = "library", repository = "nginx", name = "alpine", page_size = 1}) got("/namespaces/library/repositories/nginx/tags?name=alpine&page_size=1") local first = tags.results[1] assert(tags.count == 795 and first.digest == "sha256:600f7cd45e27aa13e9304c834ab7c1b0ff39df85ee1dcc5087955455d77bc83b") assert(first.images[1].variant == NULL and first.images[1].size == 63911306 and first.images[2].architecture == "unknown") assert(first.images[2].last_pushed == nil and first.tag_last_pushed == "2026-10-28T04:53:32.454364Z") -- The last page Docker Hub lists without signing in still links a next page, which it would refuse with HTTP 403: -- a loop following next stops at the reach error, before any request. respond('{"count":1381,"next":"https://hub.docker.com/v2/namespaces/library/repositories/nginx/tags?page=11&page_size=100",' .. '"previous":"https://hub.docker.com/v2/namespaces/library/repositories/nginx/tags?page=9&page_size=100","results":[' .. tag .. ']}') local reached = dockerhub.listTags({namespace = "library", repository = "nginx", page = 10, page_size = 100}) got("/namespaces/library/repositories/nginx/tags?page=10&page_size=100") assert(type(reached.next) == "string" and #reached.results == 1) local before = #requests local ok, err = pcall(function() dockerhub.listTags({namespace = "library", repository = "nginx", page = 11, page_size = 100}) end) assert(not ok and string.find(tostring(err), "lists stop after the first 100 repositories or 1,000 tags", 1, true), tostring(err)) assert(#requests == before, "a page beyond reach reached Docker Hub") respond('{"count":1,"next":null,"previous":null,"results":[]}') local last = dockerhub.listTags({namespace = "docker", repository = "whalesay", name = "nothing-matches"}) got("/namespaces/docker/repositories/whalesay/tags?name=nothing-matches") assert(last.next == NULL and json.encode(last.results) == "[]") -- Old single-manifest tags can have null images and a full_size of 0. respond('{"name":"latest","images":null,"full_size":0,"media_type":"application/vnd.docker.distribution.manifest.v1+prettyjws"}') local old = dockerhub.getTag({namespace = "docker", repository = "whalesay", tag = "latest"}) got("/namespaces/docker/repositories/whalesay/tags/latest") assert(old.images == NULL and old.full_size == 0) respond(tag) local latest = dockerhub.getTag({namespace = "library", repository = "nginx", tag = "latest"}) got("/namespaces/library/repositories/nginx/tags/latest") assert(latest.name == "latest" and #latest.images == 2 and latest.images[1].os_version == NULL) respond('{"name":"1.27.5-alpine3.21-perl"}') dockerhub.getTag({namespace = "library", repository = "nginx", tag = "1.27.5-alpine3.21-perl"}) got("/namespaces/library/repositories/nginx/tags/1.27.5-alpine3.21-perl") respond('{"name":"Release_2"}') dockerhub.getTag({namespace = "bitnami", repository = "redis", tag = "Release_2"}) got("/namespaces/bitnami/repositories/redis/tags/Release_2") assert(#responses == 0) end, }