Documentation Index
Fetch the complete documentation index at: https://docs.serval.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The DockerHub integration lets you automate routine container-registry work against Docker Hub. Connect Serval to DockerHub to audit images across your namespace, prune stale tags, keep repository metadata in sync, and weave Docker Hub state into broader IT and security workflows.Key Features
- List repositories in a user or organization namespace
- List and filter image tags
- Update repository descriptions
- Delete stale or unused tags
- Look up user and organization metadata
Common Use Cases
- Scheduled cleanup of tags older than a retention window
- On-call audit of repositories pushed in the last 24 hours
- Bulk-update repository descriptions during a rebrand
- Surface DockerHub state in tickets and approval flows
Prerequisites
Docker Hub account
An active Docker Hub account that owns or has access to the repositories
you want to automate.
Personal Access Token (PAT)
Docker Hub does not expose third-party OAuth, so authentication is via a
Personal Access Token created under your Docker Hub account settings.
Setup Instructions
Step 1: Generate a Personal Access Token
Open token settings
Log in to Docker Hub, open the avatar menu, and
go to Account Settings → Personal access tokens.
Create a new token
Click Generate new token. Give it a clear description (for example,
“Serval integration — production”) so it can be identified later.
Choose the access scope
Pick the smallest scope that satisfies your workflows:
- Public Repo Read — list public repositories and tags only.
- Public Repo Read & Write — also push and update public repos.
- Read-only (Repo Read) — list private repos, list tags, view image metadata.
- Read & Write (Repo Read & Write) — recommended default. Includes everything in Read-only, plus updates to repository descriptions.
- Public Repo Admin — full administration of repos in the namespace, including delete.
Step 2: Configure the integration in Serval
- Navigate to the Integrations page in Serval.
- Find DockerHub and click Configure.
- Enter your configuration details.
The Docker Hub username that owns the Personal Access Token. This is also
the default namespace for repository operations in workflows.
The Personal Access Token from Step 1. Serval stores this encrypted and
never exposes it to workflow code.
A friendly label to distinguish this connection from others (for example,
Production, Build Bot, or Org Audit). Required when you have
multiple Docker Hub connections on the same team.- Click Submit to establish the integration.
Integration configured. Serval will perform a healthcheck by exchanging
the PAT for a bearer token and calling
GET /v2/user/.How authentication works
Docker Hub does not accept a Personal Access Token directly as a bearer
token — calls return
403 token issued from personal access token is not allowed. Behind the scenes, Serval exchanges your username and PAT at
POST hub.docker.com/v2/users/login for a short-lived JWT, caches that JWT
in the proxy until shortly before its expiry, and refreshes it automatically.Your workflows never need to handle this. Just call apiRequest.API surface
All paths use the canonical/v2/namespaces/{namespace}/... form from
Docker Hub’s public OpenAPI spec.
The older /v2/repositories/{namespace}/... paths are deprecated and now
reject PAT-derived JWTs with 403 token issued from personal access token is not allowed.
Repositories (read)
Repositories (read)
All require
Public Repo Read or Repo:Read scope.GET /v2/namespaces/{namespace}/repositories— list repositories in a namespace, withpage,page_size,name, andorderingquery parametersGET /v2/namespaces/{namespace}/repositories/{repository}— repository detailsGET /v2/namespaces/{namespace}/repositories/{repository}/tags— list tagsGET /v2/namespaces/{namespace}/repositories/{repository}/tags/{tag}— get a specific tag
Repository team access
Repository team access
Granting and revoking a team’s access to a repository lives on the
PAT-allowed surface despite the team semantics (Docker Hub’s spec
intentionally keeps this endpoint PAT-callable):
POST /v2/repositories/{namespace}/{repository}/groups— grant a team access. Body:{ group_id, permission: "read" | "write" | "admin" }. Resolvegroup_idvia the DockerHub Organization integration first.
Identifying the connected user does not require an API call. The
configured username is captured at install time and exposed in the
workflow context as
ctx.integrations.dockerhub.username. /v2/user/
no longer exists in the current Hub API.What this integration cannot do
These endpoints are explicitly marked OAT-only in Docker Hub’s spec. Calls from this integration will return403 token issued from personal access token is not allowed — use the
DockerHub Organization
integration instead:
- List or search org members
- Create, update, or delete teams (groups)
- Add or remove members from teams
- List or cancel invites
- Read or list audit logs
Best Practices
Additional Resources
Docker Hub API reference
Complete reference for the Hub REST API.
Personal access tokens
Docker’s documentation on creating, scoping, and rotating PATs.
Need help? Contact support@serval.com for assistance with your DockerHub integration.

