No basic auth credentials
sourcehawk opened this issue · comments
On a new ubuntu server (22.04.1) machine with a fresh install of docker there is no .docker
folder located at home directory and therefore also no config.json
file. After following the instructions and creating those folders/files manually I get an error response from daemon. Is the credential helper just not being used at all or what exactly is happening?
Here is the setup procedure I followed.
- Install docker
$ sudo apt install docker.io
- Install the cred helper build (0.5.0-1build1)
$ sudo apt install amazon-ecr-credential-helper
- Locate the binary
$ sudo dpkg -L amazon-ecr-credential-helper
/usr/bin/docker-credential-ecr-login
- Add the binary to ~/.bashrc
echo '/usr/bin/docker-credential-ecr-login' >> ~/.bashrc
- Create ~/.docker because it doesn't exist
mkdir ~/.docker
- Create config.json file with required content
touch ~/.docker/config.json
Add the contents
- Export credentials with admin access to ecr
export AWS_ACCESS_KEY_ID=FOOBAR
export AWS_SECRET_ACCESS_KEY=BARFOO
- Try to pull docker image from aws ecr repository
sudo docker pull numbers.dkr.ecr.eu-west-1.amazonaws.com/my-repo:1.0.0
- I get an error from docker daemon
Error response from daemon: Head "https://numbers.dkr.ecr.eu-west-1.amazonaws.com/v2/my-repo/manifests/1.0.0": no basic auth credentials
I found the solution
I had to enable the command docker
to be executed without sudo
for docker to get the config file from the ubuntu user's home directory. The command in question is sudo usermod -aG docker $USER
followed by restarting the current session.