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
Copy file name to clipboardExpand all lines: Sources/swift-container-plugin/Documentation.docc/authentication.md
+27-1Lines changed: 27 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ The following examples show how to set up the plugin for some popular registry p
24
24
### Docker Hub
25
25
26
26
> Don't use your Docker Hub account password to push and pull images.
27
-
> Create a Personal Access Token, which has restricted privileges, for each integration you use.
27
+
> Create a Personal Access Token, which has restricted privileges, for each integration you use.
28
28
> By using separate tokens, you can monitor them independently and revoke one at any time.
29
29
To create a `.netrc` entry for Docker Hub:
30
30
@@ -69,6 +69,32 @@ machine ghcr.io
69
69
>
70
70
> To generate an ECR authentication token, you must [first install the AWS CLI tools.](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
71
71
72
+
#### Using environment variables
73
+
74
+
Environment variables are a convenient way to store short-lived credentials.
75
+
76
+
1.**Remove any existing ECR credentials from your `.netrc` file.** If any entries in `.netrc` match your ECR registry hostname, these will be used in preference to the credentials in environment variables.
77
+
78
+
2. Set the ECR username.
79
+
80
+
**The login name must be `AWS`**.
81
+
82
+
```
83
+
export CONTAINERTOOL_DEFAULT_USERNAME=AWS
84
+
```
85
+
86
+
3. Use the `aws` CLI tool to [generate an authentication token](https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry_auth.html#registry-auth-token).
87
+
You'll need to know the name of the [AWS region](https://docs.aws.amazon.com/global-infrastructure/latest/regions/aws-regions.html) in which your registry is hosted.
88
+
Registries in different AWS regions are separate and require different authentication tokens.
89
+
90
+
For example, the following command generates a token for ECR in the `us-west-2` region:
To create a `.netrc` entry for Amazon Elastic Container Registry:
73
99
74
100
1. Use the `aws` CLI tool to [generate an authentication token](https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry_auth.html#registry-auth-token).
0 commit comments