I found that this was an issue with the package of docker installed. On Ubuntu “apt-get install docker” installs the Docker CE. On Centos “yum install docker” installs https://cbs.centos.org/koji/buildinfo?buildID=24652. The versions show completely different packages which is why the docker push (after docker login) was failing. I simply uninstalled docker and installed “yum install docker-ce” and the “no basic auth” error no longer showed up - see details below.
If you have 1.13 you’ll need to re-install to fix the “no basic auth” message when using “docker push”:
[root@container-from-centos]# docker -v
Docker version 1.13.1, build b2f74b2/1.13.1
[root@container-from-ubuntu:16.04]# docker -v
Docker version 18.09.7, build 2d0083d
FROM https://docs.docker.com/v17.09/engine/installation/linux/docker-ce/centos/ AND in a docker centos container do:
- yum remove docker docker-common docker-selinux docker-engine
- yum-config-manager --add-repo [see documentation for url]
- yum install -y docker-ce
Now the version is good and we can push to ECR:
[root@container-from-centos]# docker -v
Docker version 18.09.7, build 2d0083d
- aws configure
- $(aws ecr get-login | sed -e ‘s/-e none//g’)
- docker push [ECR_URI]/foo/bar-image