Skip to content

Commit 3d44154

Browse files
hub: update repo export (#24396)
<!--Delete sections as needed --> ## Description Internal feedback reported that the deprecated auth endpoint does not support OATs. Updated to new auth endpoint. Upon testing the rest of the flow, the repositories endpoint has the following error, `token issued from organization access token is not allowed`. The current flow does not appear to work with OATs. Updated to PAT and tested that it worked. https://deploy-preview-24396--docsdocker.netlify.app/docker-hub/repos/manage/export/ ## Related issues or tickets https://docker.slack.com/archives/C04300R4G5U/p1773779041999559 ## Reviews <!-- Notes for reviewers here --> <!-- List applicable reviews (optionally @tag reviewers) --> - [ ] Technical review - [ ] Editorial review --------- Signed-off-by: Craig Osterhout <craig.osterhout@docker.com>
1 parent 5b39703 commit 3d44154

1 file changed

Lines changed: 28 additions & 52 deletions

File tree

  • content/manuals/docker-hub/repos/manage

content/manuals/docker-hub/repos/manage/export.md

Lines changed: 28 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
title: Export organization repositories to CSV
33
linkTitle: Export repositories
44
description: Learn how to export a complete list of your organization's Docker Hub repositories using the API.
5-
keywords: docker hub, organization, repositories, export, csv, api, access token
5+
keywords: docker hub, organization, repositories, export, csv, api, personal access token, pat
66
---
77

88
This guide shows you how to export a complete list of repositories from your
9-
Docker Hub organization, including private repositories. You'll use an
10-
Organization Access Token (OAT) to authenticate with the Docker Hub API and
11-
export repository details to a CSV file for reporting or analysis.
9+
Docker Hub organization, including private repositories. You'll use a
10+
Personal Access Token (PAT) from an administrator account to authenticate with
11+
the Docker Hub API and export repository details to a CSV file for reporting or
12+
analysis.
1213

1314
The exported data includes repository name, visibility status, last updated
1415
date, pull count, and star count.
@@ -22,52 +23,40 @@ Before you begin, ensure you have:
2223
- `jq` installed for JSON parsing
2324
- A spreadsheet application to view the CSV
2425

25-
## Create an organization access token
26+
## Create a personal access token
2627

27-
Organization access tokens let you authenticate API requests without
28-
interactive login steps.
29-
30-
1. Navigate to your organization in [Docker Home](https://app.docker.com) and select **Admin Console**.
31-
32-
2. Select **Access tokens** from the sidebar.
33-
34-
3. Select **Generate access token**.
35-
36-
4. Configure the token permissions:
37-
38-
- Under **Repository permissions**, add every repository you want the
39-
token to access
40-
- Assign at least **Image Pull** (read) access to each repository
41-
- You can add up to 50 repositories per token
42-
43-
5. Copy the generated token and store it securely.
28+
[Create a personal access token](/security/access-tokens/) from
29+
a user account that has access to the organization's repositories. When creating
30+
the token, select at minimum **Read-only** access permissions to list
31+
repositories.
4432

4533
> [!IMPORTANT]
4634
>
47-
> If you only enable **Read public repositories**, the API will only return
48-
> public repositories. To include private repositories in your export, you must
49-
> explicitly add them to the token's repository permissions.
35+
> Use a PAT from a user account that is a member of the organization. Users
36+
> with owner roles can export all organization repositories. Members can only
37+
> export repositories they have permission to access.
5038
5139
## Authenticate with the Docker Hub API
5240

53-
Exchange your organization access token for a JWT bearer token that you'll use
41+
Exchange your personal access token for a JWT bearer token that you'll use
5442
for subsequent API requests.
5543

56-
1. Set your organization name and access token as variables:
44+
1. Set your Docker Hub username, organization name, and personal access token as variables:
5745

5846
```bash
59-
ORG="<your-org>"
60-
OAT="<your_org_access_token>"
47+
USERNAME="<your-docker-username>"
48+
ORG="<org-name>"
49+
PAT="<your_personal_access_token>"
6150
```
6251

6352
2. Call the authentication endpoint to get a JWT:
6453

6554
```bash
6655
TOKEN=$(
67-
curl -s https://hub.docker.com/v2/users/login \
56+
curl -s https://hub.docker.com/v2/auth/token \
6857
-H 'Content-Type: application/json' \
69-
-d "{\"username\":\"$ORG\",\"password\":\"$OAT\"}" \
70-
| jq -r '.token'
58+
-d "{\"identifier\":\"$USERNAME\",\"secret\":\"$PAT\"}" \
59+
| jq -r '.access_token'
7160
)
7261
```
7362

@@ -142,21 +131,20 @@ spreadsheet application to view and analyze your repository data.
142131

143132
### Only public repositories appear
144133

145-
Your organization access token may only have **Read public repositories**
146-
enabled, or it lacks permissions for specific private repositories.
134+
The Docker Hub account associated with your personal access token may not have
135+
access to private repositories in the organization.
147136

148137
To fix this:
149138

150-
1. Navigate to your organization's access tokens in Docker Hub
151-
2. Select the token you created
152-
3. Add private repositories to the token's permissions with at
153-
least **Image Pull** access
139+
1. Verify the account is a member of the organization
140+
2. Check that the account has appropriate permissions (owner or member role)
141+
3. Ensure the personal access token has sufficient access permissions
154142
4. Regenerate the JWT and retry the export
155143

156144
### API returns 403 or missing fields
157145

158-
Ensure you're using the JWT from the `/v2/users/login` endpoint as a
159-
Bearer token in the `Authorization` header, not the organization access
146+
Ensure you're using the JWT from the `/v2/auth/token` endpoint as a
147+
Bearer token in the `Authorization` header, not the personal access
160148
token directly.
161149

162150
Verify your authentication:
@@ -167,15 +155,3 @@ $ curl -s "https://hub.docker.com/v2/namespaces/$ORG/repositories?page_size=1" \
167155
```
168156

169157
If this returns an error, re-run the authentication step to get a fresh JWT.
170-
171-
### Need access to all repositories
172-
173-
Organization access tokens are scoped to specific repositories you select
174-
during token creation. To export all repositories, you have two options:
175-
176-
1. Add all repositories to the organization access token (up to 50 repositories)
177-
2. Use a Personal Access Token (PAT) from an administrator account that has
178-
access across the entire organization
179-
180-
The choice between these approaches depends on your organization's security
181-
policies.

0 commit comments

Comments
 (0)