Skip to content

Commit 789e45e

Browse files
committed
docs: rewrite section on AWS credentials
The credential helper now supports a variety of different mechanisms for providing AWS credentials, and some of them are more complex than others. This commit reorganizes the description about how AWS credentials are sourced, adds more detail to the manual page, and includes information about the bugs that may exist for some Kubernetes users.
1 parent fcdc7d5 commit 789e45e

File tree

2 files changed

+60
-24
lines changed

2 files changed

+60
-24
lines changed

README.md

+38-21
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,8 @@ for the Docker daemon that makes it easier to use
1313

1414
You must have at least Docker 1.11 installed on your system.
1515

16-
You also must have AWS credentials available in one of the standard locations:
17-
18-
* The `~/.aws/credentials` file
19-
* The `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables
20-
* An [IAM role for Amazon EC2](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html)
21-
* If you are working with an assumed role please set the environment variable: `AWS_SDK_LOAD_CONFIG=true` also.
22-
23-
The Amazon ECR Docker Credential Helper uses the same credentials as the AWS
24-
CLI and the AWS SDKs. For more information about configuring AWS credentials,
25-
see
26-
[Configuration and Credential Files](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-files)
27-
in the *AWS Command Line Interface User Guide*.
28-
29-
The credentials must have a policy applied that
30-
[allows access to Amazon ECR](http://docs.aws.amazon.com/AmazonECR/latest/userguide/ecr_managed_policies.html).
31-
32-
If you are using a yet unreleased version of the plugin with web identity credentials support using
33-
AssumeRoleWithWebIdentity in your k8s containers, you would need to set `AWS_SDK_LOAD_CONFIG=true` before
34-
your invocation to `docker push`. Also, due to a current bug in k8s as discussed
35-
[here](https://github.com/kubernetes-sigs/external-dns/pull/1185), for containers that don't run as root, you
36-
would need the workaround mentioned there with `securityContext` of `nobody / 65534` on your k8s pod, otherwise, the token file is unreadable, and the plugin silently errors with a 401.
16+
You also must have AWS credentials available. See the [AWS credentials section](#aws-credentials) for details on how to
17+
use different AWS credentials.
3718

3819
## Installing
3920

@@ -150,6 +131,8 @@ Docker to work with the helper.
150131

151132
## Configuration
152133

134+
### Docker
135+
153136
Place the `docker-credential-ecr-login` binary on your `PATH` and set the
154137
contents of your `~/.docker/config.json` file to be:
155138

@@ -178,6 +161,40 @@ ECR registry:
178161
This is useful if you use `docker` to operate on registries that use different
179162
authentication credentials.
180163

164+
### AWS credentials
165+
166+
The Amazon ECR Docker Credential Helper allows you to use AWS credentials stored different locations. Standard ones
167+
include:
168+
169+
* The shared credentials file (`~/.aws/credentials`)
170+
* The `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables
171+
* An [IAM role for an Amazon ECS task](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html)
172+
* An [IAM role for Amazon EC2](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html)
173+
174+
To use credentials associated with a different named profile in the shared credentials file (`~/.aws/credentials`), you
175+
may set the `AWS_PROFILE` environment variable.
176+
177+
The Amazon ECR Docker Credential Helper can optionally read and support some configuration options specified in the AWS
178+
shared configuration file (`~/.aws/config`). To use these options, you must set the `AWS_SDK_LOAD_CONFIG` environment
179+
variable to `true`. The supported options include:
180+
181+
* Assumed roles specified with `role_arn` and `source_profile`
182+
* External credential processes specified with `credential_process`
183+
* Web Identities like [IAM Roles for Service Accounts in
184+
Kubernetes](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html) (*Note: Kubernetes
185+
users using containers with a non-root user may encounter permission issues described in [this
186+
bug](https://github.com/kubernetes-sigs/external-dns/pull/1185) and may need to employ a workaround adjusting the
187+
Kubernetes `securityContext`.*)
188+
189+
The Amazon ECR Docker Credential Helper uses the same credentials as the AWS
190+
CLI and the AWS SDKs. For more information about configuring AWS credentials,
191+
see
192+
[Configuration and Credential Files](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-files)
193+
in the *AWS Command Line Interface User Guide*.
194+
195+
The credentials must have a policy applied that
196+
[allows access to Amazon ECR](http://docs.aws.amazon.com/AmazonECR/latest/userguide/ecr_managed_policies.html).
197+
181198
## Usage
182199

183200
`docker pull 123456789012.dkr.ecr.us-west-2.amazonaws.com/my-repository:my-tag`

docs/docker-credential-ecr-login.1

+22-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ COMMAND
2323
.SH DESCRIPTION
2424
The Amazon ECR Credential Helper for Docker is a credential helper for the
2525
.BR docker (1)
26-
command that makes it easier to use Amazon Elastic Container Registry.
26+
command that makes it easier to store and retrieve container images with Amazon
27+
Elastic Container Registry.
2728
.SH USAGE
2829
Place the
2930
.B docker\-credential\-ecr\-login
@@ -63,8 +64,21 @@ EC2 instance profiles, and ECS task roles.
6364
To use credentials associated with a different named profile in the shared
6465
credentials file, you may set the \fIAWS_PROFILE\fP environment variable.
6566

66-
To use credentials from an assumed role, you must set the
67-
\fIAWS_SDK_LOAD_CONFIG\fP environment variable to \fItrue\fP.
67+
The credential helper can optionally read and support some configuration
68+
options specified in the shared configuration file (\fI~/.aws/config\fP). To
69+
use these options, you must set the \fIAWS_SDK_LOAD_CONFIG\fP environment
70+
variable to \fItrue\fP. The supported options include:
71+
.IP \[bu] 2
72+
Assumed roles specified with \fIrole_arn\fP and \fIsource_profile\fP
73+
.IP \[bu]
74+
External credential processes specified with \fIcredential_process\fP
75+
.IP \[bu]
76+
Web Identities like IAM roles for Service Accounts in Kubernetes
77+
78+
.RE
79+
The credentials must have a policy applied that allows access to Amazon ECR.
80+
See http://docs.aws.amazon.com/AmazonECR/latest/userguide/ecr_managed_policies.html
81+
for more information.
6882
.SH OPTIONS
6983
.TP 16
7084
.BR -v
@@ -90,6 +104,11 @@ This command is not implemented and is a no-op.
90104
.TP 16
91105
.BR erase
92106
This command is not implemented and is a no-op.
107+
.SH BUGS
108+
Kubernetes users using the credential helper inside containers with a non-root
109+
user may encounter permission issues described here:
110+
https://github.com/kubernetes-sigs/external-dns/pull/1185. You may be able to
111+
work around this bug by adjusting the Kubernetes \fIsecurityContext\fP.
93112
.SH COPYRIGHT
94113
Copyright 2018 Amazon.com, Inc. or its affiliates. All rights reserved.
95114
.SH LICENSE

0 commit comments

Comments
 (0)