Private ECR for Workspace Images
Using Private ECR Repositories for Workspace Images
gp validate
, you’ll need to authenticate against the private registry in your workspace. See below for an example of how to setup and authenticate using OIDC.gp validate
emulates a workspace start using the Docker daemon running in your workspace. To prevent unintended security repercussions, the credentials used during workspace start are not automatically made available in the workspace.Authenticating Enterprise with a Private ECR Repository
-
Navigate to the AWS account where the target ECR repository is located.
-
Modify the target ECR repositories resource policy (repositories > permissions) with the following entry:
How to use an Image from a Private ECR Repository in a .gitpod.yml
File
-
Ensure you’ve followed the authentication steps from the section above.
-
In your
.gitpod.yml
file, directly reference the private ECR image:.gitpod.yml
How to use an Image from a Private ECR Repository in Combination with Custom Dockerfiles
-
Ensure you’ve followed the authentication steps from the section above.
-
In your project repository, create a Dockerfile that references your private ECR image:
-
In your
.gitpod.yml
file, reference the Dockerfile:.gitpod.yml
Ensure that your image and Dockerfile adhere to the same requirements described here.
Use OIDC with a Private ECR Repository for gp validate
Setup an Identity Provider
Ensure an Identity Provider (IDP) is setup in IAM in the account hosting the Private ECR Repository for Gitpod Enterprise.
Note: IDP has connectivity requirements. Gitpod Enterprise can be configured to expose Gitpod services publicly.
Setup IAM in the account hosting the Private ECR Repo
-
The Role you create must have specific Permissions to allow developers to pull from the Private ECR Repo. The Trust Relationship is flexible.
- The Permissions should look similar to:
- The Trust relationships should look similar to the below, except the Conditions may vary depending on your needs:
- The above condition restricts role usage to a single repo and all branches.
- Refer to AWS documentation if you require a more complicated set of Conditions.
-
Persist the ARN of the Role you’ve configured somewhere where developers can access it from a Gitpod Workspace.
- For example, you could persist it as a Repository Environment Variable.
-
At this point, the new role is ready to be assumed by developers.
Use OIDC to log into the Private ECR Repository
-
Ensure you’ve followed the steps above to setup an IAM Identity Provider and Role.
-
Ensure the AWS CLI is installed for your Gitpod Workspace.
-
Assume the role
-
At this point, you should be able to
gp validate
Was this page helpful?