Log in to a container registry on a Reoclo-managed server using a registry credential stored in your Reoclo tenant.
Pairs with @reoclo/run and @reoclo/checkout for full CI workflows that build, push, and pull from private registries without copying passwords into GitHub Secrets.
Most registry login GitHub Actions require you to copy the registry password into a GitHub Actions secret for every repository that needs it. @reoclo/docker-auth sources the password from your Reoclo tenant instead, so you get:
- One place to rotate. Update the password in the Reoclo dashboard and every workflow picks up the new value on the next run.
- Per-key access control. Scope each automation API key to exactly the credentials and servers it is allowed to use.
- Full audit trail. Every login and logout is recorded with the originating repository, workflow, actor, and commit.
- No copies of your password in GitHub Secrets. The credential never leaves your Reoclo tenant.
name: Build and push private image
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Log in to private GHCR
uses: reoclo/docker-auth@v1
with:
api_key: ${{ secrets.REOCLO_API_KEY }}
server_id: ${{ secrets.REOCLO_SERVER_ID }}
credential_id: ${{ secrets.REOCLO_GHCR_CREDENTIAL_ID }}
- name: Build and push on server
uses: reoclo/run@v1
with:
api_key: ${{ secrets.REOCLO_API_KEY }}
server_id: ${{ secrets.REOCLO_SERVER_ID }}
working_directory: /opt/deploy/workspace
command: |
docker build -t ghcr.io/myorg/myapp:${{ github.sha }} .
docker push ghcr.io/myorg/myapp:${{ github.sha }}
timeout: 600The login happens on your Reoclo server, so your next @reoclo/run steps can build, push, or pull from the same registry without any extra plumbing. When the job ends, a cleanup step automatically logs out.
- Create a registry credential in Reoclo.
- Open Registry Credentials in the dashboard.
- Click Add Credential and pick your provider (Docker Hub, GitHub Container Registry, AWS ECR, Google Artifact Registry, Azure ACR, Harbor, or Generic).
- Enter the username and password or token for that provider.
- Save and copy the credential UUID from the detail page.
- Create an Automation API key.
- Open API Keys and switch to the Automation Keys tab.
- Click Create Key and give it a name (for example,
github-prod). - Set Allowed Operations to include
registry_login(andregistry_logoutfor the cleanup step). - Set Allowed Servers to the target server.
- Set Allowed Credentials to include the credential from step 1.
- Save and copy the plaintext key. It is shown once.
- Add the secrets to your GitHub repository.
REOCLO_API_KEY: the automation key you just created.REOCLO_SERVER_ID: the UUID of your Reoclo server.REOCLO_<NAME>_CREDENTIAL_ID: one per registry credential you plan to use.
The fastest way to get the exact snippet is the Use in CI button on the Registry Credentials page. It pre-fills the credential and server UUIDs for you.
| Input | Required | Default | Description |
|---|---|---|---|
api_key |
Yes | Reoclo automation API key (starts with rca_). |
|
server_id |
Yes | Target Reoclo server UUID. | |
credential_id |
Yes | Reoclo registry credential UUID. | |
cleanup |
No | true |
Run docker logout on the target server at job end. |
| Output | Description |
|---|---|
operation_id |
Reoclo operation ID for the login. Useful for cross-referencing the audit log. |
registry_url |
Resolved registry URL (for example, ghcr.io, docker.io, or the ECR host). |
registry_type |
Registry provider (docker_hub, ghcr, aws_ecr, google_artifact_registry, azure_acr, harbor, generic). |
Use one step per credential. Each step creates its own login and logout in the audit log, which keeps failures scoped to a single credential.
- name: Log in to GHCR
uses: reoclo/docker-auth@v1
with:
api_key: ${{ secrets.REOCLO_API_KEY }}
server_id: ${{ secrets.REOCLO_SERVER_ID }}
credential_id: ${{ secrets.REOCLO_GHCR_CREDENTIAL_ID }}
- name: Log in to AWS ECR
uses: reoclo/docker-auth@v1
with:
api_key: ${{ secrets.REOCLO_API_KEY }}
server_id: ${{ secrets.REOCLO_SERVER_ID }}
credential_id: ${{ secrets.REOCLO_ECR_CREDENTIAL_ID }}Use this when the credential should persist across multiple jobs in the same workflow run. Not recommended for ephemeral runners.
- uses: reoclo/docker-auth@v1
with:
api_key: ${{ secrets.REOCLO_API_KEY }}
server_id: ${{ secrets.REOCLO_SERVER_ID }}
credential_id: ${{ secrets.REOCLO_CREDENTIAL_ID }}
cleanup: 'false'- name: Log in
id: login
uses: reoclo/docker-auth@v1
with:
api_key: ${{ secrets.REOCLO_API_KEY }}
server_id: ${{ secrets.REOCLO_SERVER_ID }}
credential_id: ${{ secrets.REOCLO_ECR_CREDENTIAL_ID }}
- name: Pull image
uses: reoclo/run@v1
with:
api_key: ${{ secrets.REOCLO_API_KEY }}
server_id: ${{ secrets.REOCLO_SERVER_ID }}
command: docker pull ${{ steps.login.outputs.registry_url }}/myapp:latest- The action calls the Reoclo API with the server ID and the credential ID.
- Reoclo logs in to the registry on your server.
- The action waits for the login to finish and sets
registry_url,registry_type, andoperation_idas outputs. - Subsequent workflow steps on the same server can pull or push from the registry.
- When the job ends, the action runs
docker logouton the server so the login does not persist.
Every step is recorded in your Reoclo audit log along with the GitHub workflow context.
- The registry password is never returned to the GitHub Actions runner.
- The action's outputs contain only the resolved registry URL, the registry provider type, and a Reoclo operation ID.
- Logins and logouts are recorded in your Reoclo audit log alongside the repository, workflow, actor, and commit that triggered them.
- Automation API keys must explicitly allow each credential they can use. Keys cannot reference credentials outside your tenant.
- If you enable cleanup (the default),
docker logoutruns on the server at job end so the credential does not stay resident on the server filesystem.
MIT