API keys and CI
Create, use and revoke the keys that Docker and CI log in with.
View as MarkdownAn API key is your password for docker login. Each key belongs to the person who created it. You see and revoke only your own keys.
Create a key
- Sign in to the registry’s web address with your email and open API keys. If you are new, accept your invite first.
- Select Create key. If you have no keys, select Create your first key.
- Enter a Name, up to 32 characters. Use one that tells you where the key is used.
- Choose a Scope and when it Expires.
- Select Create key.
- Copy the key and store it in your password manager or CI secrets.
- Select Done.
Imagine shows the key once. It stores a hash and the first six characters, so nobody can show you the whole key again. If you lose it, revoke it and create another.
Scopes
| Scope | Pull | Push |
|---|---|---|
| Read | Yes | No |
| Read & write (default) | Yes | Yes |
A scope covers every repository in the registry. You can’t limit a key to one repository.
A key works only for pushing and pulling. It can’t sign in to the web UI, call the UI’s API, change visibility or delete images. This is true for an admin’s key too.
Expiry
| Expires | The key stops working |
|---|---|
| In 30 days | 30 days after you create it |
| In 90 days (default) | 90 days after you create it |
| In 1 year | 365 days after you create it |
| Never | Only when you revoke it or your account loses access |
You can’t change the name, scope or expiry of a key in the web UI. Create a new key instead.
Check your keys
API keys lists each key’s name, first characters, scope, created date, last use and expiry. A key with under 14 days left is highlighted. An expired key can show Expired for a short time, then Imagine deletes it from the list.
Replace a key
- Create a new key with the scope you need.
- Update the machine or CI secret, and check that it works.
- Revoke the old key.
Revoke a key
- Open API keys and select Revoke beside the key.
- Check the name and last use, then select Revoke key.
You can’t undo this. Jobs and machines that use the key can no longer log in with it.
Docker swaps a key for a registry token that lasts up to 5 minutes. The Revoke key dialog says that anything using the key stops working immediately, but a token issued before you revoke the key, or before it expires, keeps working until the token itself expires. Links to layers that Imagine already gave out also work until they expire, 15 minutes by default.
Removed and banned users
Removing a user deletes all their keys. Their keys and registry tokens stop working right away. Layer links already given out still work until they expire. Images they pushed stay.
A banned user’s keys and tokens also stop working. The keys are not deleted, so any that have not expired work again if the ban ends.
CI uses the key of the person who created it. Before someone leaves, replace their key in CI with another person’s. Imagine has no separate account type for CI.
Limits
| Limit | Value |
|---|---|
| Name | 32 characters |
| Longest set expiry in the web UI | 365 days, or never |
| Repositories per key | All of them |
| Request limit per key | None in Imagine |
Your TLS proxy or network may have its own limits.
Log in from a script
Put the key in a secret environment variable, then pass it on standard input. This keeps it out of the shell history and the command line.
echo "$IMAGINE_KEY" | docker login registry.example.com -u you@example.com --password-stdinIn CI:
- Create a key. Use Read for jobs that only pull.
- Store it as a secret named
IMAGINE_KEYin your CI system. - Run the login, then build and push:
set -eu
image="registry.example.com/team/app:$VERSION"
echo "$IMAGINE_KEY" | docker login registry.example.com -u you@example.com --password-stdin
docker build -t "$image" .
docker push "$image"
docker logout registry.example.comSet VERSION to a valid tag, such as a commit hash. The username can be any text without a colon, but using the key owner’s email makes the login easy to recognize.
GitHub Actions
- Create a Read & write key.
- In your GitHub repository’s settings, open the Actions secrets and add a repository secret named
IMAGINE_KEYwith the key as its value. - Save this file as
.github/workflows/image.yml. Change the host, email, branch and image name.
name: Build and push image
on:
push:
branches: [main]
permissions:
contents: read
jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: docker/login-action@v4
with:
registry: registry.example.com
username: you@example.com
password: ${{ secrets.IMAGINE_KEY }}
- uses: docker/setup-buildx-action@v4
- uses: docker/build-push-action@v7
with:
context: .
push: true
tags: |
registry.example.com/team/app:latest
registry.example.com/team/app:${{ github.sha }}A GitHub-hosted runner must be able to reach the registry host and the S3 host over the network.
This workflow has not been run against Imagine. GitHub recommends pinning actions to a commit hash.
If a job fails to log in, see Common errors.