Prerequisites
Before you begin, ensure you have:- GCP runners deployed and configured for your Ona environments
- GAR registry in the same GCP project as your runners (or with appropriate cross-project access)
- gcloud CLI installed and authenticated with appropriate permissions to manage IAM policies
- Runner name and project ID from your Ona runner configuration
Setting up Google Artifact Registry Access
Step 1: Create Container Registry Secret
- Navigate to Project > Secrets > New Secret in your Ona dashboard
- Select Container Registry Basic Auth from the type dropdown
-
For the Registry hostname, enter your GAR registry hostname in the format:
[region]-docker.pkg.dev
Examples:us-central1-docker.pkg.dev
(for US Central region)europe-west1-docker.pkg.dev
(for Europe West region)asia-southeast1-docker.pkg.dev
(for Asia Southeast region)
-
When you enter a GAR registry hostname, the username and password fields will automatically be filled with
runner-native
to indicate that native runner authentication will be used - Click Add
Runner-native Authentication: When you enter a GAR hostname, Ona automatically detects this as a supported registry and enables runner-native authentication, eliminating the need for manual credential management.
Step 2: Configure Service Account Permissions
Your GCP runner creates an environment VM service account that needs access to your GAR repositories.Identify Your Environment Service Account
Your environment service account follows this naming pattern:gcp-runner-01
in project my-project-123
, the service account would be:
Grant Repository Access (Recommended)
Use thegcloud
command to grant access to specific repositories:
Alternative: Project-level Access
For broader access, you can grant project-level permissions:Step 3: Configure Your Dev Container
Update your.devcontainer/devcontainer.json
to use your private GAR image:
Required IAM Roles
The minimum required role for accessing GAR repositories is:Verification
To verify the permissions are correctly configured:Check Repository-level Permissions
Check Project-level Permissions
Verify Service Account Exists
Troubleshooting
Image Pull Failures
If you’re experiencing image pull failures, verify:-
Service account name is correct:
-
IAM permissions are correctly applied:
-
Repository exists and is accessible:
Authentication Errors
If you see authentication errors in your environment logs:- Ensure the GAR hostname format is correct:
[region]-docker.pkg.dev
- Verify that your runner and registry are in the same project or have cross-project access configured
- Check that the service account has the minimum required role:
roles/artifactregistry.reader
- Confirm the service account name matches the expected pattern
Common Error Messages
“Failed to pull image”- Check that the image exists in the specified repository
- Verify the image tag is correct
- Ensure the service account has pull permissions
- Confirm the container registry secret is properly configured
- Verify the service account has the correct IAM roles
- Check that the GAR hostname matches your registry region
Limitations
- GCP runners only: GAR runner-native registry support is only available for GCP runners
- Same project recommended: Your GCP runners and GAR registry should be in the same project for simplest configuration
- Environment recreation required: Existing environments must be recreated to apply changes to GAR permissions
- No automatic docker login: Unlike basic auth registries, GAR doesn’t automatically log you into the registry from within the environment. Use gcloud auth or Ona OIDC for additional registry access from within your environment
Next Steps
- Learn more about GCP runner setup
- Explore container registry secrets for other registry types
- Configure OIDC authentication for additional cloud service access