Posted at

How to fix docker login "tls: handshake failure"


Symptom

cannot login / fetch docker registry/image ???

$ docker login registry.docker.xxx

Authenticating with existing credentials...
Login did not succeed, error: Error response from daemon: Get https://registry.docker.xxx: remote error: tls: handshake failure


from Docker Engine release notes

https://docs.docker.com/engine/release-notes/

18.09

2018-11-08

End of Life Notification

In this release, Docker has also removed support for TLS < 1.2 moby/moby#37660, Ubuntu 14.04 “Trusty Tahr” docker-ce-packaging#255 / docker-ce-packaging#254, and Debian 8 “Jessie” docker-ce-packaging#255 / docker-ce-packaging#254.


How to fix -
back to the older version


  • check which version of docker-ce

# yum list installed | grep docker

containerd.io.x86_64 1.2.0-3.el7 @docker-ce-stable
docker-ce.x86_64 3:18.09.0-3.el7 @docker-ce-stable
docker-ce-cli.x86_64 1:18.09.0-3.el7 @docker-ce-stable


  • remove the latest

# yum remove docker-ce-cli

Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package docker-ce-cli.x86_64 1:18.09.0-3.el7 will be erased
--> Processing Dependency: docker-ce-cli for package: 3:docker-ce-18.09.0-3.el7.x86_64
--> Running transaction check
---> Package docker-ce.x86_64 3:18.09.0-3.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================================
Removing:
docker-ce-cli x86_64 1:18.09.0-3.el7 @docker-ce-stable 66 M
Removing for dependencies:
docker-ce x86_64 3:18.09.0-3.el7 @docker-ce-stable 81 M

Transaction Summary
============================================================================================================================================================
Remove 1 Package (+1 Dependent package)

Installed size: 147 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
/usr/bin/dockerd has not been configured as an alternative for dockerd
Erasing : 3:docker-ce-18.09.0-3.el7.x86_64 1/2
Erasing : 1:docker-ce-cli-18.09.0-3.el7.x86_64 2/2
Verifying : 1:docker-ce-cli-18.09.0-3.el7.x86_64 1/2
Verifying : 3:docker-ce-18.09.0-3.el7.x86_64 2/2

Removed:
docker-ce-cli.x86_64 1:18.09.0-3.el7

Dependency Removed:
docker-ce.x86_64 3:18.09.0-3.el7

Complete!


  • install the specific version

# yum install docker-ce-18.06.1.ce

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 0:18.06.1.ce-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================================
Installing:
docker-ce x86_64 18.06.1.ce-3.el7 docker-ce-stable 41 M

Transaction Summary
============================================================================================================================================================
Install 1 Package

Total download size: 41 M
Installed size: 41 M
Is this ok [y/d/N]: y
Downloading packages:
docker-ce-18.06.1.ce-3.el7.x86_64.rpm | 41 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : docker-ce-18.06.1.ce-3.el7.x86_64 1/1
Verifying : docker-ce-18.06.1.ce-3.el7.x86_64 1/1

Installed:
docker-ce.x86_64 0:18.06.1.ce-3.el7

Complete!


  • login

# service docker start

Redirecting to /bin/systemctl start docker.service

# docker login registry.docker.xxx
Authenticating with existing credentials...
WARNING! Your password will be stored unencrypted in /xxx/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded