You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lead with single-step OIDC login, move two-step to advanced section
login-action v4.5.1 now handles OIDC token exchange natively when
DOCKERHUB_OIDC_CONNECTIONID is set. This is simpler for the common
case. The two-step flow using docker/oidc-action is preserved for
workflows that need the token as a separate output.
Copy file name to clipboardExpand all lines: content/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-docker.md
+34-12Lines changed: 34 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ To use OIDC with Docker, establish a trust relationship between {% data variable
47
47
48
48
## Updating your {% data variables.product.prodname_actions %} workflow
49
49
50
-
Once you have created an OIDC connection in Docker, update your workflow to authenticate using the [`docker/oidc-action`](https://github.com/docker/oidc-action) and [`docker/login-action`](https://github.com/docker/login-action)actions.
50
+
Once you have created an OIDC connection in Docker, update your workflow to authenticate using the [`docker/login-action`](https://github.com/docker/login-action)action.
51
51
52
52
The following example uses the placeholder `YOUR_CONNECTION_ID` for the connection ID you copied from Docker, and `YOUR_DOCKER_ORG` for your Docker organization name.
53
53
@@ -64,17 +64,12 @@ jobs:
64
64
- name: Check out repository
65
65
uses: {% data reusables.actions.action-checkout %}
* **`permissions.id-token: write`** is required so that {% data variables.product.prodname_dotcom %} can issue an OIDC token for the workflow.
89
-
* The `docker/oidc-action` exchanges the {% data variables.product.prodname_dotcom %} OIDC token for a short-lived Docker access token based on your connection's rulesets.
90
-
* The `docker/login-action` uses the token output to authenticate with Docker Hub. The `username` field should be your Docker organization name.
84
+
* 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.
85
+
* The `username` field should be your Docker organization name.
86
+
87
+
### Using the token as an output
88
+
89
+
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:
90
+
91
+
```yaml
92
+
{% data reusables.actions.actions-not-certified-by-github-comment %}
0 commit comments