Safeguard Docs
Integrations

Docker Hub

Connect Docker Hub to Safeguard. The access permission the personal access token needs, which token types work, and step-by-step setup.

What it does

The Docker Hub card connects Safeguard to container images on Docker Hub. Safeguard lists the repositories of your Docker Hub namespace and their tags, and each image you select becomes a project that Safeguard scans for an SBOM and vulnerability findings. Find the card under Integrations on the Project/Product tab.

Public vs private

PublicPrivate
What you enterA Docker Hub URL such as https://hub.docker.com/_/nginx or https://hub.docker.com/r/<user>/<image>Your Docker Hub username and a personal access token
Credential neededNoneA Docker Hub personal access token (PAT)
What you can selectThe public images you add by URLThe repositories in the namespace you connect, with their tags

Private image scans

Safeguard uses the token to list your repositories and tags. The scan's image pull does not use this token yet, so a private image the scanner cannot pull is reported as a failed scan with the registry's error.

Supported auth methods

MethodUse it whenNotes
Username and personal access tokenPrivate repositoriesRecommended. The token is sent once to Docker Hub's login endpoint to obtain a short-lived bearer token.
Username and account passwordOnly if you cannot create a PATWorks when your organization does not enforce SSO. Docker recommends a PAT instead.
NonePublic imagesNothing to create.

Permissions required

Safeguard only reads from Docker Hub. It never pushes, deletes or changes images, tags or repository settings.

Personal access token

Access permissionRequired?What Safeguard uses it for
Repo Read-onlyRequired for private repositoriesSigning in (POST /v2/users/login), listing the namespace's repositories and listing each repository's tags
Repo Public Read-onlyEnough for public repositories onlyListing public repositories of the namespace; private repositories are not visible
Allow Cloud Sandboxes accessNot usedLeave it off

Least privilege: a PAT with Repo Read-only and an expiration date. Docker scopes a PAT's repository permission to every repository your account can reach, so use an account that can see only what Safeguard should scan.

Token types

Token typeWorks?Notes
Personal access token, Repo Read-onlyYes (recommended)
Personal access token, Repo Read & Write or Repo Read, Write, DeleteWorks, not recommendedSafeguard never writes or deletes
Personal access token, Repo Public Read-onlyPartlyOnly public repositories are listed
Organization access token (OAT)NoSafeguard lists repositories on the /v2/repositories/{namespace} path, which Docker Hub rejects for OATs
Account passwordWorks, not recommendedNot available when the organization enforces SSO
A GitHub token (ghp_...) or any other vendor's tokenNoSafeguard detects a pasted GitHub token and says so

Expiry: choose 30 days or 90 days, or a Custom date up to one year. Docker's default, None, never expires; avoid it. You cannot change a PAT's expiration later, so rotate by creating a new token.

What we never need: write or delete permissions, Cloud Sandboxes access, organization owner rights, or your account password when a PAT is possible.

Step-by-step setup

Create the credential in Docker Hub

  1. Sign in to Docker Home.
  2. Select your avatar, then Account settings.
  3. Select Personal access tokens, then Generate new token.
  4. Enter an Access token description (for example Safeguard), pick an Expiration date, and under Access permissions choose Repo Read-only.
  5. Select Generate, then copy the token. Docker shows it once and does not store it.

Or with the Docker CLI

Docker has no CLI command that creates a PAT. To check the token before you paste it into Safeguard:

docker login --username <your-docker-id>
# Password: paste the PAT
docker logout

Connect it in Safeguard

  1. Open Integrations and choose the Project/Product tab.
  2. Click Connect on the Docker Hub card.
  3. For public images, choose Public, enter a Name, paste a Docker Hub URL, click Add, then Next.
  4. For private repositories, choose Private, enter a Name, your Docker Hub Username and the Access Token.
  5. Click Verify Credentials. "Docker Hub credentials verified successfully!" means Docker Hub accepted the token.
  6. Click Next, select repositories and tags, review, and choose a connect option (fast, progressive or deep scan).

Webhooks and triggers

This integration has no webhooks. Each selected image is scanned when you connect it; to rescan new tags, set a schedule under Integrations > Scheduled or rescan by hand from the project.

What we read and store

  • Read: repository names, descriptions and visibility in your namespace, tag names and update dates, and the images you select for scanning.
  • Stored: the connection's settings, the SBOM and findings of each scanned image, and the username and token, which are encrypted at rest and never shown again after you save them.
  • Not stored: image layers. The image is read for the scan and not kept.
  • No customer data from this integration is sent to third-party LLMs.

Troubleshooting

Message you seeCauseFix
Please enter both username and access token to verifyA field is emptyEnter your Docker ID and the PAT
Docker Hub rejected the credentials for user '<name>'. Verify the Docker Hub username and Personal Access Token, and that the PAT has at least read access. ...Wrong username, an expired or revoked PAT, or a PAT copied with extra charactersRe-copy the raw token from Docker Hub, check it has not expired, and use your Docker ID (not your email) as the username
Docker Hub rejected the credentials ... The supplied token starts with 'ghp_' ...A GitHub token was pastedCreate a Docker Hub PAT instead
Invalid Docker Hub URL formatThe public URL is not a Docker Hub image pageUse https://hub.docker.com/_/<image> or https://hub.docker.com/r/<user>/<image>
Image is private. Use private authentication.A private image was added on the Public tabUse the Private tab with a PAT
Image not found on Docker HubThe image name is wrong or the image was deletedCheck the URL on Docker Hub
Namespace (username/organization) is required for Docker HubThe connection has no namespaceEnter the username or organization whose repositories you want

Rotation and disconnect

  • Rotate: generate a new PAT, find the connection under Project Configurations on the Project/Product tab, choose Update from its menu, paste the new token and save, then delete the old token in Account settings > Personal access tokens.
  • Disconnect: choose Delete from the connection's menu under Project Configurations and confirm Delete configuration, then delete the PAT in Docker Hub.

Vendor references

On this page