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
For information on common image registries, see "[Common image registry servers](#common-image-registry-servers)."
77
+
For information on common image registries, see "[Common image registry servers](#common-image-registry-servers)." Note that accessing AWS Elastic Container Registry (ECR) is different.
Once you've added the secrets, you may need to stop and then start the codespace you are in for the new environment variables to be passed into the container. For more information, see "[Suspending or stopping a codespace](/codespaces/codespaces-reference/using-the-command-palette-in-codespaces#suspending-or-stopping-a-codespace)."
82
82
83
+
#### Accessing AWS Elastic Container Registry
84
+
85
+
To access AWS Elastic Container Registry (ECR), you can provide an AWS access key ID and secret key, and {% data variables.product.prodname_dotcom %} can retrieve an access token for you and log in on your behalf.
86
+
87
+
```
88
+
*_CONTAINER_REGISTRY_SERVER = <ECR_URL>
89
+
*_CONTAINER_REGISTRY_USER = <AWS_ACCESS_KEY_ID>
90
+
*_container_REGISTRY_PASSWORD = <AWS_SECRET_KEY>
91
+
```
92
+
93
+
You must also ensure you have the appropriate AWS IAM permissions to perform the credential swap (e.g. `sts:GetServiceBearerToken`) as well as the ECR read operation (either `AmazonEC2ContainerRegistryFullAccess` or `ReadOnlyAccess`).
94
+
95
+
Alternatively, if you don't want GitHub to perform the credential swap on your behalf, you can provide an authorization token fetched via AWS's APIs or CLI.
96
+
97
+
```
98
+
*_CONTAINER_REGISTRY_SERVER = <ECR_URL>
99
+
*_CONTAINER_REGISTRY_USER = AWS
100
+
*_container_REGISTRY_PASSWORD = <TOKEN>
101
+
```
102
+
103
+
Since these tokens are short lived and need to be refreshed periodically, we recommend providing an access key ID and secret.
104
+
105
+
While these secrets can have any name, so long as the `*_CONTAINER_REGISTRY_SERVER` is an ECR URL, we recommend using `ECR_CONTAINER_REGISTRY_*` unless you are dealing with multiple ECR registries.
106
+
107
+
For more information, see AWS ECR's "[Private registry authentication documentation](https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry_auth.html)."
108
+
83
109
### Common image registry servers
84
110
85
111
Some of the common image registry servers are listed below:
@@ -90,6 +116,6 @@ Some of the common image registry servers are listed below:
If you want to access AWS Elastic Container Registry (ECR), you must provide an AWS authorization token in the `ECR_CONTAINER_REGISTRY_PASSWORD`. This authorization token is not the same as your secret key. You can obtain an AWS authorization token by using AWS's APIs or CLI. These tokens are short lived and will need to be refreshed periodically. For more information, see AWS ECR's "[Private registry authentication documentation](https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry_auth.html)."
121
+
If you are having trouble pulling an image from a private image registry, make sure you are able to run `docker login -u <user> -p <password> <server>`, using the values of the secrets defined above. If login fails, ensure that the login credentials are valid and that you have the apprioriate permissions on the server to fetch a container image. If login succeeds, make sure that these values are copied appropriately into the right {% data variables.product.prodname_codespaces %} secrets, either at the user, repository, or organization level and try again.
0 commit comments