Cannot push to AWS ECR

Error response from daemon: Registration: "Wrong username format (it has to match \"^[a-z0-9]{4,30}$\")" Action failed: docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS $DOCKER_URL

I have the environment variables set on my build through the CircleCI UI.

This does not happen when I use docker locally: Docker version 1.9.1, build a34a1d5

I did try upgrading to Docker 1.9 as discussed here: Docker 1.9.0 is available

Why does a username have to be 4+ characters? My username is AWS, because that’s how the AWS ECR product does it.

1 Like

Is docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS $DOCKER_URL the whole command? I think you need to specify registry address.

This looks the similar issue.

1 Like

Yes, the command looks like:

docker login -u AWS -p <password> -e none https://<id>.dkr.ecr.us-east-1.amazonaws.com

So the $DOCKER_URL is the registry address, I believe. When I run the command locally it is working, just not when it runs in my deploy step in DockerCI.

I was able to get it to work by switching the arguments to docker login. Originally I had the -e none as the first argument. After switching it to match the command I copied above, it works!

1 Like