Docker login hangs - AWS EC2 AMI Image

Expected behavior

execution of following command will finish in several seconds (always)

eval $(aws ecr get-login --region eu-central-1 --debug --profile xxx)

Actual behavior

execution of following command SOMETIMES get stucked on ‘docker login’ and even after one hour of waiting it does not continue

eval $(aws ecr get-login --region eu-central-1 --debug --profile xxx)

Additional Information

I tried to set up debug mode and I can see aws-cli client was able to get authentication token from remote service. And it hangs on docker login itself…

I’m using AWS EC2 service

$ cat /etc/os-release
NAME=“Amazon Linux AMI”
VERSION=“2016.09”
ID=“amzn”
ID_LIKE=“rhel fedora”
VERSION_ID=“2016.09”
PRETTY_NAME=“Amazon Linux AMI 2016.09”
ANSI_COLOR=“0;33”
CPE_NAME=“cpe:/o:amazon:linux:2016.09:ga”
HOME_URL=“AWS | Amazon Linux AMI

$ docker version
Client:
Version: 1.11.2
API version: 1.23
Go version: go1.5.3
Git commit: b9f10c9/1.11.2
Built:
OS/Arch: linux/amd64

Server:
Version: 1.11.2
API version: 1.23
Go version: go1.5.3
Git commit: b9f10c9/1.11.2
Built:
OS/Arch: linux/amd64

Steps to reproduce the behavior