Docker not able to pull images behind proxy TLS handshake timeout - docker

I have latest Docker version 18.06.0 installed on CentOS 7.
My server is in a corporate network so using a proxy server to access the registry.
I have added proxy settings as per docker documentation.
But finally adding proxy settings in worked partially. i.e. now docker is using proxy to pull the image before it runs.
But now it fails giving following error:
$ sudo docker run hello-world
Unable to find image ‘hello-world:latest’ locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: proxyconnect tcp: net/http: TLS handshake timeout.
Also, the login fails:
$ sudo docker login --username=XXXX
Password:
Error response from daemon: Get https://registry-1.docker.io/v2/: proxyconnect tcp: EOF
My proxy is pretty fast. When I’m using it to download anything from the internet using wget or curl I see 90 to 100Mbps speed.
Other applications utils on my machine such as yum are using this proxy perfectly and it works well.
Now I don’t know why only Docker has a problem in downloading the images.
The details of installation and configuration are as follow:
Version:
$ sudo docker version
Client:
Version: 18.06.0-ce
API version: 1.38
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:08:18 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.0-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:10:42 2018
OS/Arch: linux/amd64
Experimental: false
OS Version:
Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511
Docker proxy config:
$ cat /etc/systemd/system/docker.service.d/https-proxy.conf
[Service]
Environment=“HTTP_PROXY=http://pqr.corp.xxx.com:8080”
Environment=“HTTPS_PROXY=https://pqr.corp.xxx.com:8080”
Environment=“NO_PROXY=localhost,127.0.0.1”
after adding this configuration I have already done
sudo systemctl daemon-reload
sudo systemctl restart docker
Looking for specific help.
I have gone through most of the posts on TLS Handshake Timeout issues but didn’t get any answer or suggestions working for me.
My proxy is fine and docker is using it. I don’t understand why it gets that nasty timeout.

The config file is:
[Service]
Environment=“HTTP_PROXY=http://pqr.corp.xxx.com:8080”
Environment=“HTTPS_PROXY=https://pqr.corp.xxx.com:8080”
Environment=“NO_PROXY=localhost,127.0.0.1”
Notice that 3rd line: HTTPS_PROXY=https
Is the proxy server support HTTPS? Or there should be an error.
Maybe HTTPS_PROXY=http is correct.
By the way, a similar error is Get https://registry-1.docker.io/v2/: proxyconnect tcp: EOF

Reason is usually related with your network settings. Especially, if your Docker is set up with Proxy, make it temporary with "No Proxy" option and it should work.
Cheers

I was also facing same issue behind firewall. Follow below steps:
$ sudo vim /etc/systemd/system/docker.service.d/http_proxy.conf
[Service]
Environment=“HTTP_PROXY=http://username:password#IP:port/”
Don’t use or remove https_prxoy.conf file.
reload and restart your docker
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
$ docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:2557*********************************8
Status: Downloaded newer image for hello-world:latest

The answers before mine point towards this direction, but neither states it clearly: Removing all https proxy settings solves this problem. I had a https-proxy.conf file just like OP's and docker pull started to work after I deleted the HTTPS_PROXY line. I know that the https proxy I use works all right so it must be a problem on Docker's side.
I found this solution on serverfault.

Related

Issue: Cannot connect to the Docker daemon at unix:///home/tonton/.docker/desktop/docker.sock. Is the docker daemon running?

Hello Guys when I run docker version
My docker compose version is : docker compose version
Docker Compose version v2.2.2
Client: Docker Engine - Community
Version: 20.10.18
API version: 1.41
Go version: go1.18.6
Git commit: b40c2f6
Built: Thu Sep 8 23:11:43 2022
OS/Arch: linux/amd64
Context: desktop-linux
Experimental: true
Cannot connect to the Docker daemon at unix:///home/tonton/.docker/desktop/docker.sock. Is the docker daemon running?
I am using ubuntu 22.04 version.
In my case:
I had installed docker desktop by apt in ubuntu20.04 before, but removed it later .
And when I try to check sudo docker images today there is the same issue.
Restarting docker, chown socket and some other strange ways don't work.
Suddenly I discover that there is no such socket file in docker/desktop/, but in the default location /var/run. Then trying to restore docker default context by docker context use default makes everything come back to normal.
So I think that the remained docker-desktop context takes the responsibility.....

Docker Windows Client doesn't start and there is no icon in system tray

Recently, I installed Docker for Windows and pulled the Get-starting container for WLS and it worked fine.
However, after I restarted my computer, the client doesn't start automatically, when I once start it manually nothing happened and after starting it again, it shows me docker failed to initialize
the operation has timed out.
I don't remember doing something that makes a problem.
Then I checked the version of Docker in powershell ad administrator and the result is:
PS C:\Windows\system32> docker version
error during connect: In the default daemon configuration on Windows,
the docker client must be run with elevated privileges to connect.: Get
"http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/version": open
//./pipe/docker_engine: The system cannot find the file specified.
Client:
Cloud integration: 1.0.17
Version: 20.10.7
API version: 1.41
Go version: go1.16.4
Git commit: f0df350
Built: Wed Jun 2 12:00:56 2021
OS/Arch: windows/amd64
Context: default
Experimental: true
I also tried the command (& 'C:\Program Files\Docker\Docker\DockerCli.exe' -SwitchDaemon) here in this question and it doesn't work.
Any help would be appreciated.

Can't get docker start on Ubuntu?

This is what I have:
suyashdew#DESKTOP-DPRQ445:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
suyashdew#DESKTOP-DPRQ445:~$ docker version
Client:
Version: 18.09.1
API version: 1.39
Go version: go1.10.6
Git commit: 4c52b90
Built: Wed Jan 9 19:35:23 2019
OS/Arch: linux/amd64
Experimental: false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I am new to *nix systems and I am trying to work on it. Please help!
Note: I have tried
sudo service docker start
* Starting Docker: docker
sudo service docker status
* Docker is not running
I have tried several ways mentioned in other threads but nothing worked. One of the ways broke the docker-ce and I had to remove it from the package and then re-install it. And it still can't fix it.
You probably can't connect because you're not the root user and you're not in the docker group. Make sure to follow the Linux post-install instructions, and don't forget to re-start your computer after adding yourself to the docker group.
You can verify whether this is the problem or not before trying all of that - does sudo docker version work?
might be a permission issue.
This are the postinstallation steps for linux:
docker post installation
you could try with sudo.
if you've the same issue with sudo, try
service docker status
and
service docker start

Running hello-world Docker on Libreelec/Kodi on Raspberry Pi causes response from daemon error

I'm trying to follow this tutorial to install Docker on my Librelect/Kodi Raspberry pi box. I have followed all the steps but when I run:
docker -H 0.0.0.0:2375 run hello-world
I get the error message:
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp:lookup registry-1.docker.io on 192.168.1.1:53: read udp 192.168.1.55:40093->192.168.1.1:53: i/o timeout.
See 'docker run --help'.
I have seen other posts with similar problems but all are on decent operating systems with proper Unix tools like service and proper package managers. For example almost all of the commands suggested on this page lead to -sh: <command> not found errors. On Libreelec the only package manager I have found so far is Entware, which is a hassle to get around. I would appreciate if you could Help me know what is the problem and how I can solve it.
P.S.1. When I run docker version I get the message:
Client:
Version: 1.13.1
API version: 1.26
Go version: go1.7.5
Git commit: 1.13.1
Built: Sat Jul 15 18:44:26 UTC
2017 OS/Arch: linux/arm
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
P.S.2 It has been mentioned in some posts that changing DNS server to 8.8.8.8 and 8.8.4.4 on Docker settings solves the problem. But I don't know how to do this.

Error Connecting to Docker hub

I have created a docker hub account and trying to connect on it to push an image. I am getting the following error:
>>>docker login -u <username> -p <password>
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
I run this and i got the following message:
>>>curl https://registry-1.docker.io/v2/
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}
Also:
>>> env | grep -i proxy
gave no result(means that i dont have proxy settings??)
>>> docker version
Client:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built: Wed Oct 26 22:01:48 2016
OS/Arch: linux/amd64
Server:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built: Wed Oct 26 22:01:48 2016
OS/Arch: linux/amd64
Any idea how to overpass that?
Modified DNS server setting to 8.8.8.8 and it worked.
In my case (Ubuntu 16.04, Docker 18.01.0), I could solve it by setting the proxy like below.
$ sudo mkdir -p /etc/systemd/system/docker.service.d
$ sudo vi /etc/systemd/system/docker.service.d/http_proxy.conf
[Service]
Environment="HTTP_PROXY=http://<your_proxy_ip>:<your_proxy_port>/"
$ sudo vi /etc/systemd/system/docker.service.d/https_proxy.conf
[Service]
Environment="HTTPS_PROXY=http://<your_proxy_ip>:<your_proxy_port>/"
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
This issue sometimes reoccurs randomly on docker:
If you get this error and are not blocked by a proxy, perform the following steps:
Restart docker-machine
docker-machine restart default
Reset to default env
eval $(docker-machine env default)
If you try again, you may find that everything just works fine.
If you are in Linux. You can change nameserver in /etc/resolv.conf.
Set the nameserver to 8.8.8.8.
Restart the docker demon. sudo systemctl restart docker.
I have the same issue and then resolved the issue by configured the docker environment http_proxy, because i'm behind a corp proxy:
https://docs.docker.com/engine/admin/systemd/#http-proxy
I faced the same issue for win 10 pro. After both changes, I was able to log-in and pull images.
If you want to use windows as a container. Right-click docker whale icon and -> switch to windows container.
If you want to use Linux as a container. (Your machine must have a
password for login)
Right-click docker whale icon and -> switch to Linux container.
Go to Settings click shared drives and select D or C or both.
Enter the windows user password and save changes.
Mac High Sierra / Docker 18:
In my case I had to sign out my Docker User (directly in the Docker menu).
I just switched from Mac to corporate Windows 10 machine, so getting to the Docker GUI was not obvious, I had to expand the carret ("^"), then right click on Docker icon:
I chose Settings in the right click menu to bring up the Docker GUI. In the Docker GUI, I clicked on Proxies and added the (actual) address of my company proxy:
Also of note, I was able to login to our internal repository and Docker Hub so that I could pull images from both places - so my config.json file looked (something) like this:
{
"auths": {
"company.internal.rep.com:9000": {},
"https://index.docker.io/v1/": {}
},
"HttpHeaders": {
"User-Agent": "Docker-Client/18.09.2 (windows)"
},
"credsStore": "wincred"
}
I had the same issue. My solution was to specify the correct repository parameter. I've registered at hub.docker.com. So I've added it as parameter to docker login command:
docker login -u username -p password hub.docker.com
If you still have an error, please check that it is not a network issue with your proxy by using the following command:
curl -I -x PROXY_USERID:PROXY_PASSWORD#YOUR_PROXY:PROXY_PORT http://google.com
As well I've used ip address instead of host name to specify my proxy to exclude DNS errors.
If you got error with curl, then you need configure docker http_proxy and https_proxy.
Docker 18 / Windows 10:
In Settings > Network > DNS Sever - Select fixed and enter your DNS Server IP.
In Docker settings -> Network, I switched the DNS Server setting to "Fixed" as in the screenshot below and it worked!
In Linux (Ubuntu)
Edit network interface
nano /etc/network/interfaces
Replace dns-nameservers some_ip_address to dns-nameservers 8.8.8.8
dns-nameservers 8.8.8.8
Restart networking
sudo systemctl restart networking
Note: If google dns (dns-nameservers 8.8.8.8
) is not working use open dns (dns-nameservers 208.67.222.222)
I got the same issue, i just restarted the docker service and it works fine for me
$ sudo service docker restart
$ docker login
Open the docker whale icon and restart docker.
There's no proxy in my setup so this was resolved with a simple docker restart. This can be done easily via cli or gui
Define in your host operating system's network configuration a standard gateway for the docker adapter and also one for DNS. This solved the problem for me.

Resources