Docker login to ECR with instance profile

I've set up an ECR connection with default credential provider chain so that the instance profile is used. But when I run my build with docker support enabled to login to ECR I'm getting this exception:

Unable to load AWS credentials from any provider in the chain: [EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY)), SystemPropertiesCredentialsProvider: Unable to load AWS credentials from Java system properties (aws.accessKeyId and aws.secretKey), com.amazonaws.auth.profile.ProfileCredentialsProvider@2da80e45: profile file cannot be null, com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@7db85ee3: The requested metadata is not found at http://169.254.169.254/latest/meta-data/iam/security-credentials/
 
It seems the instance profile is missing from the URL, because if you add it to the end of the URL you get back an access key and access secret.

Please sign in to leave a comment.