docker / machine

Machine management for a container-centric world
https://docs.docker.com/machine/
Apache License 2.0
6.63k stars 1.97k forks source link

Unable to pull images from AWS ECR #4620

Open p0fi opened 5 years ago

p0fi commented 5 years ago

Im trying to pull an image from AWS ECR for my builds to use. In order to use the ECR I need to docker login or to use the ECR Docker Credential Helper.

The second is what im trying to do. I install the helper like this via user_data

#!/bin/bash
# install  credential helper
wget https://github.com/lox/amazon-ecr-credential-helper/releases/download/v1.0.0/docker-credential-ecr-login_linux_amd64 -O /usr/local/bin/docker-credential-ecr-login
# update docker config to use ecr-login
mkdir /home/ubuntu/.docker
echo '{"credsStore":"ecr-login"}' > /home/ubuntu/.docker/config.json

but the pull always fails with the message:

ERROR: Preparation failed: Error response from daemon: Get https://<repo>:<tag> no basic auth credentials (executor_docker.go:168:0s)

If I look up the generated SSH keys form the machine and manually log into the instance I can just fine enter sudo docker pull ... and I directly get the image.

Why does the automatic pull fail always? 🤔

christopher-dG commented 5 years ago

Have you tried configuring Docker for root user instead? (in case you are still working on this)