我已经设置了Artifactory Pro Docker映像版本5.4.5。我同时使用Nginx和使用自签名证书启用的HTTPS。当我尝试运行docker pull
命令时,出现错误:
[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
工作正常。
[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
在Artifactory服务器上,
$ 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配置:
$ 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;
}
}
我确实查看了official guide和其他几篇在线文章,但是自最近两天以来一直无法正常运行。非常感谢您的帮助。
答案 0 :(得分:0)
不确定将来是否对某人有帮助,但是当图像名称中的地址错误时,我遇到了相同的错误。
就我而言,我使用的是'AspNetCore-Culture'
而不是bintray.com/jfrog/artifactory-pro:latest
答案 1 :(得分:0)
我在几种情况下都遇到过此错误。其中一种情况是我在 ~/.docker/config.json
中有任意存储库。我试图 docker login
到 docker.io 而不是我们的公司注册表,所以我在 ~/.docker/config.json
中有相应的身份验证记录。我删除了它,一切正常