首页 > 解决方案 > Artifactory Docker 登录到存储库本地主机

问题描述

我有一个本地的 Jfrog Artifactory Pro。

我使用“ http://localhost:8081/artifactory/webapp/#/home ”来访问我的 Artifactory。

我创建了本地 Docker 注册表:

在此处输入图像描述

在此处输入图像描述

我从 Rest API 配置了一个直接反向代理:

$ curl -u admin:xxxxxx-i "http://127.0.0.1:8081/artifactory/api/system/configuration/webServer"

HTTP/1.1 200 OK
Server: Artifactory/6.2.0
X-Artifactory-Id: de89ec654198c960:3f9aa2d0:167a7c20d5e:-8000
Access-Control-Allow-Methods: GET, POST, DELETE, PUT
Access-Control-Allow-Headers: X-Requested-With, Content-Type, X-Codingpedia
Cache-Control: no-store
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sun, 16 Dec 2018 13:04:52 GMT

{
  "key" : "direct",
  "webServerType" : "DIRECT",
  "artifactoryAppContext" : "artifactory",
  "publicAppContext" : "artifactory",
  "serverName" : "127.0.0.1",
  "serverNameExpression" : "*.localhost",
  "artifactoryServerName" : "localhost",
  "artifactoryPort" : 8081,
  "dockerReverseProxyMethod" : "SUBDOMAIN",
  "useHttps" : false,
  "useHttp" : true,
  "httpsPort" : 443,
  "httpPort" : 8081,
  "upStreamName" : "artifactory"
}

来自工件的配置:

在此处输入图像描述

我想通过 docker 客户端登录到我的注册表“mylocaldocker”,但出现错误:

$ docker login mylocaldocker.localhost -u admin -p xxxxxx
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://mylocaldocker.localhost/v2/: dial tcp: lookup mylocaldocker.localhost on 192.168.65.1:53: no such host

如何登录工件 docker 注册表?并将图像拉/推到它!?

标签: dockerartifactorydocker-registry

解决方案


第一:与Artifactory相关的docker login -> Configurations -> HTTP Settings 我用“Docker access method”作为“Repository path”

码头工人登录 -u 管理员 -p **** xxxx:8081

第二:由于 docker 的限制,我们不能使用登录到 localhost。我们应该用真机IP(私有IP)替换“localhost”或“127.0.0.1”。

并将 private_ip:8081 (xxxx:8081) 添加到 docker 中的不安全注册表中。请参阅此链接中的答案:Pull Artifactory Docker Images


推荐阅读