error unmarshalling content: invalid character '<' looking for beginning of value
Asked Answered
P

5

7

I have Artifactory Pro Docker image version 5.4.5 set up. I am using Nginx as well with HTTPS enabled using self-signed certificate. When I try running docker pull command, i get error:

[root@tom ~]# docker pull docker-dev.artifactory.company.com/docker/hello-world
Using default tag: latest
Error response from daemon: error unmarshalling content: invalid character '<' looking for beginning of value

docker login works fine.

[root@tom ~]# docker login docker-dev.artifactory.company.com --username admin --password password
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

On Artifactory server,

$ cat /data/nginx/logs/access.log
ip = 10.150.16.53 user = "-" local_time = "31/May/2019:16:52:25 +0000" host = docker-dev.artifactory.company.com request = "GET /v2/ HTTP/1.1" status = 302 bytes = 0 upstream = "103.224.212.222:80" upstream_time = 0.548 request_time = 0.548 referer = "-" UA = "docker/18.09.5 go/go1.10.8 git-commit/e8ff056 kernel/3.10.0-693.17.1.el7.x86_64 os/linux arch/amd64 UpstreamClient(Docker-Client/18.09.5 \x5C(linux\x5C))"
ip = 10.150.16.53 user = "-" local_time = "31/May/2019:16:52:27 +0000" host = docker-dev.artifactory.company.com request = "GET /v2/docker/hello-world/manifests/latest HTTP/1.1" status = 302 bytes = 0 upstream = "103.224.212.222:80" upstream_time = 0.521 request_time = 0.521 referer = "-" UA = "docker/18.09.5 go/go1.10.8 git-commit/e8ff056 kernel/3.10.0-693.17.1.el7.x86_64 os/linux arch/amd64 UpstreamClient(Docker-Client/18.09.5 \x5C(linux\x5C))"

Nginx configuration:

$ cat /data/nginx/conf.d/artifactory.conf
###########################################################
## this configuration was generated by JFrog Artifactory ##
###########################################################

## add ssl entries when https has been set in config
ssl_certificate  /var/opt/jfrog/nginx/ssl/example.pem;
ssl_certificate_key  /var/opt/jfrog/nginx/ssl/example.key;
ssl_session_cache shared:SSL:1m;
ssl_prefer_server_ciphers   on;
## server configuration
server {
    listen 443 ssl;
    listen 80 ;
    server_name ~(?<repo>.+)\.artifactory.company.com artifactory.company.com;

    if ($http_x_forwarded_proto = '') {
        set $http_x_forwarded_proto  $scheme;
    }
    ## Application specific logs
    ## access_log /var/log/nginx/artifactory.company.com-access.log timing;
    ## error_log /var/log/nginx/artifactory.company.com-error.log;
    rewrite ^/$ /artifactory/webapp/ redirect;
    rewrite ^/artifactory/?(/webapp)?$ /artifactory/webapp/ redirect;
    rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/$repo/$1/$2;
    chunked_transfer_encoding on;
    client_max_body_size 0;
    location /artifactory/ {
    proxy_read_timeout  900;
    proxy_pass_header   Server;
    proxy_cookie_path   ~*^/.* /;
    if ( $request_uri ~ ^/artifactory/(.*)$ ) {
        proxy_pass          http://artifactory.company.com:80/artifactory/$1;
    }
    proxy_pass          http://artifactory.company.com:80/artifactory/;
    proxy_set_header    X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host:$server_port/artifactory;
    proxy_set_header    X-Forwarded-Port  $server_port;
    proxy_set_header    X-Forwarded-Proto $http_x_forwarded_proto;
    proxy_set_header    Host              $http_host;
    proxy_set_header    X-Forwarded-For   $proxy_add_x_forwarded_for;
    }
}

I did check the official guide and few other online articles but couldn't get it working since last two days. Will really appreciate some help.

Pensioner answered 31/5, 2019 at 17:38 Comment(2)
#38387309Xi
I have already seen that answer before but the suggestions don't look relevant for my set up. Both the client and Artifactory instances are in my corporate network only.Pensioner
C
6

Not sure if this helps someone in future, but I had a same error when the address in the image name was wrong. In my case I used bintray.com/jfrog/artifactory-pro:latest, instead of jfrog-docker-reg2.bintray.io/jfrog/artifactory-pro:latest

Comfrey answered 14/11, 2020 at 14:6 Comment(1)
Same for me with docker pull nexus.foo.com/whatever instead of my-docker-repo.nexus.foo.com/whatever.Hypergolic
M
3

Examine very carefully for typos

I got the error when I had a tiny typo:

docker pull gchr.io/path/to/image:latest
Error response from daemon: error unmarshalling content: invalid character '<' looking for beginning of value

once I changed to ghcr

docker pull ghcr.io/path/to/image:latest

it immediately worked.

Small tip

  • Some repositories used to store and distribute container images (e.g. dockerhub, ghcr, artifactory) will give you the exact line of code necessary to clone the image if you visit the image's page. If you copy/paste it it should definitely work. Example (ghcr):

enter image description here

Monniemono answered 26/4, 2023 at 7:46 Comment(1)
Instead of ghCr I was using ghRc. I was getting crazy. Thanks!!Cleanse
B
0

I have experienced this error in several cases. One of the cases was when i had arbitrary repository in ~/.docker/config.json. I tried to docker login to docker.io instead of our corporate registry, so i had correspoding auth record in ~/.docker/config.json. I deleted it and everything worked

Burnout answered 3/3, 2021 at 13:5 Comment(0)
K
0

I have the same problem, when I did not write url for my local repository in docker-compose.yml file.

Example:

version: '3'

services:
  postgres:
    image: localrepository.com/library/postgres:15
    domainname: postgres
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_USER=user
      - POSTGRES_PASSWORD=pass
Kishke answered 27/9, 2024 at 8:31 Comment(0)
G
-1

Short answer

I fixed it by reinstalling docker.

Detailed answer

I fixed it by uninstalling docker completely using this commands: https://askubuntu.com/a/1021506/557784

To completely uninstall Docker:

Step 1

dpkg -l | grep -i docker

To identify what installed package you have:

Step 2

sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli
sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce  

The above commands will not remove images, containers, volumes, or user created configuration files on your host. If you wish to delete all images, containers, and volumes run the following commands:

sudo rm -rf /var/lib/docker /etc/docker
sudo rm /etc/apparmor.d/docker
sudo groupdel docker
sudo rm -rf /var/run/docker.sock

You have removed Docker from the system completely.

And then install docker again:

sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common


curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
Guardafui answered 2/4, 2022 at 19:51 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.