Docker image pull error invalid character
Asked Answered
P

5

5

I am trying to pull a docker image from the DTR and I am getting below error

#docker pull repo/appname
Trying to pull repository  repo/appname ...
Pulling repository repo/appname
**invalid character '<' looking for beginning of value**

I am not sure what's wrong. I just googled and found below link related to the error but no help.

https://github.com/stripe/stripe-go/issues/642

Pung answered 13/8, 2020 at 3:57 Comment(2)
You're getting a non-success http response from docker registry servers. It may happen if you're living somewhere that they've blocked access to, and you'll get 403 (this happens to millions of people trying to access dockerhub). Otherwise, you may get 404 if you're entering the registry url not properly, or maybe 5xx if there is something wrong with the registry server.Reduced
HI all.. The issue was due to the image was missing in the DTR.. the image was pushed to a different DTR in my organization and the pull was from different DTR. Hence the image was missing , it gave me the above error.. Thanks all for contributing..Pung
P
2

The issue in my case was actually the image was missing in DTR.

I didn't know they had multiple DTR's with almost similar names (except few characters) in my organization. So the image was pushed to ABC DTR, but the pull was looking into XYZ DTR.

Hence, I got the above error. I am able to successfully pull the image from the right DTR.

Pung answered 14/8, 2020 at 4:55 Comment(0)
S
6

A previous answer suggested a network issue.

In your case, regarding access to a DTR (Docker Trusted Registry), it could also be a right issue.
For example, if a docker login is needed in order to access that image, a 404 HTML page would be send back, and a docker command would not know how to interpret an HTML answer (starting with <!DOCTYPE html>), hence the invalid character '<')

Actually, BMitch helpfully points out in the comments the DTR would send back a json message, not HTML:

This < is from something else intercepting the request before it gets to the registry API.

Something is capturing the request before it makes it to the registry API. Network proxy, or a reverse proxy within the container.
Either way the docker login shouldn't help.

I'd curl the registry url/port and see what is generating the error.

Surrebuttal answered 13/8, 2020 at 5:40 Comment(5)
The 403 back from the registry with a json body for the error message is part of the registry API for unauthorized requests. This < is from something else intercepting the request before it gets to the registry API.Klemens
@Klemens OK so some proxy or other intermediate server between the client and the internet DTR.Surrebuttal
@Klemens I had the same issue with my Nexus 3 acting as a Docker registry, proxy-cache for the actual internet Docker registry.Surrebuttal
Yup, something is capturing the request before it makes it to the registry API. Network proxy, or a reverse proxy within the container. Either way the docker login shouldn't help. I'd curl the registry url/port and see what is generating the error.Klemens
@Klemens Good points. I have included your comment in the answer for more visibility.Surrebuttal
P
2

The issue in my case was actually the image was missing in DTR.

I didn't know they had multiple DTR's with almost similar names (except few characters) in my organization. So the image was pushed to ABC DTR, but the pull was looking into XYZ DTR.

Hence, I got the above error. I am able to successfully pull the image from the right DTR.

Pung answered 14/8, 2020 at 4:55 Comment(0)
F
0

My issue was that Docker Desktop was out of date. Once I updated that, it worked. When loading Docker Desktop I saw a "failed" message there too.

Froissart answered 8/7, 2022 at 14:14 Comment(0)
U
0

Our team recently received the same issue, except that the invalide character was c.

After investigating deeply, one of our collegue pointed out something concerning buildkit https://docs.docker.com/build/buildkit/. In order to test it, it was needed to de-activate buildkit for the deamon and restarting it in order to try to determine if it was still doing it. With buildkit de-activated, everything was working well. But we wanted to keep buildkit activated to improve performance, so our last chance was just to reset Docker Desktop. enter image description here

Unbecoming answered 20/3, 2023 at 20:23 Comment(0)
G
0

I had a similar issue with docker pull <image> but the error was a bit more verbose:

ERROR: error parsing HTTP 400 response body: invalid character '<' looking for beginning of value: "<html>\r\n<head><title>400 The SSL certificate error</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n<center>The SSL certificate error</center>\r\n<hr><center>openresty</center>\r\n</body>\r\n</html>\r\n"

I found out that certs were out of date (/etc/docker/certs.d/<docker hostname>)1, so I had to update client.cert from machine_public.pem and client.key from machine_private.pem (used cp <dir>/machine_(public|private).pem <dir>/client.(cert|key) ... separate commands for each)

1 https://docs.docker.com/engine/security/certificates/#:~:text=A%20custom%20certificate%20is%20configured,%2Fetc%2Fdocker%2Fcerts.

Grove answered 29/3, 2023 at 13:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.