15

When I go docker pull hello-world I get the below error message:

Error response from daemon: error parsing HTTP 408 response body: invalid character '<' looking for beginning of value: "<html><body><h1>408 Request Time-out</h1>\nYour browser didn't send a complete request in time.\n</body></html>\n\n"

Installed Docker version:

Client:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   b9f10c9
 Built:        Wed Jun  1 21:47:50 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   b9f10c9
 Built:        Wed Jun  1 21:47:50 2016
 OS/Arch:      linux/amd64

Installed using: curl -fsSL https://get.docker.com/ | sh

I have ensured that network exists and I can reach other sites. Please help

Update 1: The issue cannot be of setting MTU because I could pull the images from Docker hub a few days back on the same machine.

The issue cannot be of HTTP_PROXY either because I am in my home network

Romaan
  • 2,645
  • 5
  • 32
  • 63
  • Seems a bit odd but try looking at this github issue: [timeouts pulling images](https://github.com/docker/docker/issues/20628). Describes same error, and some using Docker v1.11.x (MTU issue). You could also try installing 1.12rc version. – ldg Jul 15 '16 at 06:10

6 Answers6

18

I have run across this issue a couple times with Raspberry Pi boards running various flavors of Debian/Raspbian (RPi model info was obtained by cat /proc/cpuinfo | grep Model):

  • Raspberry Pi Model B Rev 1 with Raspbian based on Debian 11 (bullseye)
  • Raspberry Pi 4 MOdel B Rev 1.4 with Debian 10 (buster)

In both cases, running docker run --rm hello-world resulted in the 408 HTTP status code reported in the original question in this thread:

$ docker run --rm hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: error parsing 
HTTP 408 response body: invalid character '<' 
looking for beginning of value: "<html><body>
<h1>408 Request Time-out</h1>\nYour browser 
didn't send a complete request in time.\n</body>
</html>\n".
See 'docker run --help'.

The solution (noted as an aside by @Romaan) was to adjust the MTU. I did this as follows:

sudo ip link set dev eth0 mtu 1400
docker run --rm hello-world

and the hello-world container was successfully pulled and executed.

Examples of how to permanently adjust the MTU for a network interface on Debian may be found here.

Lemon Cat
  • 1,002
  • 11
  • 14
  • I confirm in my similar case it was MTU size (1400) due to LTE (4G) mobile operator network setup. Although also I had to switch my OpenVPN that I also use from UDP to TCP to get it completely resolved due to poor network quality. – Alexred Feb 23 '23 at 11:48
5

The error message is little misleading. The problem was not that there was invalid character, but the network was misconfigured. I had one LAN interface and one WLAN interface.

LAN interface connects to a router A which forward requests to router B which was connected to internet. While the WLAN interface was directly connected to router B. I forgot to remove the WLAN configuration.

Once I ensured the WLAN interface is removed, things worked smoothly.

In short: Ensured DNS resolution works and that MTU is set right.

Another possible reason for error

If you are using Mac, please ensure to allow Unrestriction Access to Web Content like below:

enter image description here

Another possible step in troubleshooting

Ensure there is no proxy or web filter in your network, that is, if possible connect to your 3G network and try again to see if the results are different

Romaan
  • 2,645
  • 5
  • 32
  • 63
  • Exactly! I just got the same error when I have two network interfaces with different settings. After I close one interface the problem is solved! – fifman Aug 28 '20 at 02:21
  • hi i am facing this issue for my own private repo on dockerhub. when i try `docker pull username/repo:tag` it gives me `repo does not exist or requires docker login` error, and when I try `docker pull hub.docker.com/username/repo:tag` it gives me the `error parsing HTTP 404 response body` error. I am successfully logged into the docker CLI. Am I missing a step? – Spencer Trinh Jan 01 '21 at 20:28
  • Are you using Mac or Linux @SpencerTrinh ? – Romaan Jan 01 '21 at 21:52
  • hi @Romaan, I developed on macosx and pushed from it too. But for work I am using Win10 with Docker Desktop (WSL). This is the laptop that I can't pull from. It seems to pull fine from the Mac osx though. Does it have to do anything with proxies? I saw some threads that mention this, but no written solution on what to do – Spencer Trinh Jan 01 '21 at 22:16
  • @Romaan Thanks your fix for mac worked. I don't understand what it's doing though. Can you explain what it did? – junecng Mar 21 '21 at 23:04
  • 1
    Mac filters the traffic @junecng and it blocks and sends an error with its page. And then docker does not expect that response, so it throws up error in turn – Romaan Mar 23 '21 at 00:51
4

That error message looks like it's coming from a proxy server. From the docker pull documentation

Proxy configuration

If you are behind an HTTP proxy server, for example in corporate settings, before open a connect to registry, you may need to configure the Docker daemon’s proxy settings, using the HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables. To set these environment variables on a host using systemd, refer to the control and configure Docker with systemd for variables configuration.

The link to the instructions for configuring systemd with a proxy is straightforward.

BMitch
  • 231,797
  • 42
  • 475
  • 450
2

It's really internet connection. Change MTU.

ip link set dev [interface] mtu [size]
ip enp1s0 mtu 1000 up

You can get your device info using

ip a
Biddut Mitra
  • 165
  • 4
1

I ran into this problem on Ubuntu. I managed to solve it by disconnecting from NordVPN:

$ nordvpn disconnect
You are disconnected from NordVPN.

It seems the VPN somehow slowed down the dockerhub traffic and broke my docker pulls.

malfroid
  • 139
  • 2
  • 9
0

There is a high chance that this is caused due to internet connectivity issue, try to rerun when the internet connection is stable.