Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 51 additions & 69 deletions content/manuals/enterprise/security/oidc-connections/create-manage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Create and manage OIDC connections
linkTitle: Create and manage connections
description: Create, update, and delete OIDC connections for your organization
keywords: oidc connections, create oidc connection, github actions, docker/oidc-action, openid connect, enterprise security, admin
keywords: oidc connections, create oidc connection, github actions, docker/login-action, openid connect, enterprise security, admin
tags: [admin]
weight: 10
---
Expand Down Expand Up @@ -33,68 +33,51 @@ YAML file.
1. Select **Create connection**.
1. Copy your OIDC connection ID.

### Step 2: Define the GitHub Actions workflow

1. Add a top-level `permissions` key that requests a GitHub OIDC ID token:

```yaml
permissions:
id-token: write
```

1. Define a job that triggers the OIDC exchange. Update `connection_id`
with the connection ID you copied from Docker:

```yaml
jobs:
login:
runs-on: ubuntu-latest
steps:
- name: OIDC connections
id: docker_oidc
uses: docker/oidc-action@v1
with:
connection_id: <YOUR_CONNECTION_ID>
```

1. Add a step that signs in to Docker with an access token once the ID
token passes authentication:

```yaml
- name: Sign in to Docker Hub
uses: docker/login-action@{{% param "login_action_version" %}}
with:
username: <DOCKER_ORGANIZATION_NAME>
password: ${{ steps.docker_oidc.outputs.token }}
```

The `username` value must be an organization name. Personal accounts
aren't supported.

Your updated workflow YAML should look like this:

```yaml
permissions:
id-token: write

jobs:
login:
runs-on: ubuntu-latest
steps:
- name: OIDC connections
id: docker_oidc
uses: docker/oidc-action@v1
with:
connection_id: <YOUR_CONNECTION_ID>

- name: Sign in to Docker Hub
uses: docker/login-action@{{% param "login_action_version" %}}
with:
username: <YOUR_ORGANIZATION_NAME>
password: ${{ steps.docker_oidc.outputs.token }}
```

1. Run your GitHub Action and verify the workflow can sign in to Docker.
### Step 2: Update your workflow

Add the OIDC connection ID and your Docker organization name as
[GitHub Actions variables](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables)
in your repository or organization settings. Then update your workflow:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker organization? GitHub repository? IDK what your take is but since both of us share these words, might want to risk some redundancy to specify which we mean. WYT @gmondello


```yaml
name: ci

on:
push:
branches: main

permissions:
contents: read
id-token: write

jobs:
login:
runs-on: ubuntu-latest
steps:
-
name: Login to Docker Hub
uses: docker/login-action@{{% param "login_action_version" %}}
env:
DOCKERHUB_OIDC_CONNECTIONID: ${{ vars.DOCKERHUB_OIDC_CONNECTIONID }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to x2 confirm, meant to be an all caps variable?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm intentional, yippee

with:
username: ${{ vars.DOCKERHUB_ORGANIZATION }}
Comment on lines +53 to +63

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dotjoshrc Is docker-login action the default way we want to people to use OIDC?

```

The `id-token: write` permission lets the workflow request a GitHub OIDC

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little dense to read as a full paragraph. We can either add this context next to the key/value pairs as code comments for in-line documentation, or maybe use unordered lists? It's fine as is just a little nit lol:

"

  • The workflow requests a GitHub OIDC token with the id-token: write permission.
  • The docker/login-action handles the OIDC token exchange and Docker login in a single step when DOCKERHUB_OIDC_CONNECTIONID is set and password is omitted.
  • The username value must be an organization name. Personal accounts aren't supported.
    "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `id-token: write` permission lets the workflow request a GitHub OIDC
The workflow requests a GitHub OIDC token with the `id-token: write` permission

token. The `docker/login-action` handles the OIDC token exchange and
Docker login in a single step when `DOCKERHUB_OIDC_CONNECTIONID` is set
and `password` is omitted.

The `username` value must be an organization name. Personal accounts
aren't supported.
Comment on lines +71 to +72

@crazy-max crazy-max Jul 29, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use a callout for this and if we have a link to roadmap issue tracking personal accounts support that would be great.

Suggested change
The `username` value must be an organization name. Personal accounts
aren't supported.
> [!IMPORTANT]
> The `username` value must be an organization name. Personal accounts
> aren't supported at the moment.


Run your GitHub Action and verify the workflow can sign in to Docker.

> [!TIP]
> If your workflow needs the Docker access token as a separate output
> (for example, for API calls or custom authentication flows), use
> [`docker/oidc-action`](https://github.com/docker/oidc-action) to
> perform the token exchange explicitly.

## Manage OIDC connections

Expand All @@ -118,14 +101,13 @@ your Docker resources without deleting the connection. While a connection
is deactivated:

- It can't issue Docker access tokens.
- Without Docker access tokens, `docker/oidc-action` fails at the
token-exchange step until you activate the connection.
- The login step in your workflow will fail at the token-exchange step
until you activate the connection.

Unlike deactivation, deleting an OIDC connection is permanent. Any workflow
whose `docker/oidc-action` step still references the deleted
`connection_id` fails at the token-exchange step. Update that input with a
replacement connection's ID in every affected workflow before it runs
again.
that still references the deleted connection ID will fail at the
token-exchange step. Update the connection ID in every affected workflow
before it runs again.

## What's next

Expand Down