环境
- harbor v1.8.1
- docker 18.09.7
- centos 7.0 3.10.0-514.26.2.el7.x86_64
错误日志
Aug 4 11:09:37 172.19.0.1 registry[9897]: 172.19.0.4 - - [04/Aug/2019:03:09:37 +0000] "GET /v2/ HTTP/1.1" 401 87 "http://registry:5000/v2" "Go-http-client/1.1"
Aug 4 11:09:47 172.19.0.1 registry[9897]: time="2019-08-04T03:09:47.505407836Z" level=info msg="response completed" go.version=go1.11.8 http.request.host="registry:5000" http.request.id=44811ed5-5220-49ed-9c14-8d87e2901e92 http.request.method=GET http.request.remoteaddr="172.19.0.4:43546" http.request.uri="/v2" http.request.useragent="Go-http-client/1.1" http.response.contenttype="text/html; charset=utf-8" http.response.duration="83.104µs" http.response.status=301 http.response.written=39
Aug 4 11:09:47 172.19.0.1 registry[9897]: 172.19.0.4 - - [04/Aug/2019:03:09:47 +0000] "GET /v2 HTTP/1.1" 301 39 "" "Go-http-client/1.1"
Aug 4 11:09:47 172.19.0.1 registry[9897]: time="2019-08-04T03:09:47.507475432Z" level=warning msg="error authorizing context: authorization token required" go.version=go1.11.8 http.request.host="registry:5000" http.request.id=c1d0d3db-7876-439e-948f-72dde90397e1 http.request.method=GET http.request.referer="http://registry:5000/v2" http.request.remoteaddr="172.19.0.4:43546" http.request.uri="/v2/" http.request.useragent="Go-http-client/1.1"
配置harbor http方式
cat harbor.yml
# Configuration file of Harbor
# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: mini1
# http related config
http:
# port for http, default is 80. If https enabled, this port will redirect to https port
port: 80
# https related config
# https:
# # https port for harbor, default is 443
# port: 443
# # The path of cert and key files for nginx
# certificate: /your/certificate/path
# private_key: /your/private/key/path
# Uncomment external_url if you want to enable external proxy
# And when it enabled the hostname will no longer used
external_url: http://mini1
# The initial password of Harbor admin
# It only works in first time to install harbor
# Remember Change the admin password from UI after launching Harbor.
harbor_admin_password: Harbor12345
# Harbor DB configuration 物理机mysql密码
database:
# The password for the root user of Harbor DB. Change this before any production use.
password: 123456
# The default data volume
data_volume: /data
docker push 到harbor,正确的操作方法
1.cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://qgcuuo71.mirror.aliyuncs.com"],
"insecure-registries": ["http://mini1:80"]
}
2.docker login http://mini1:80 -注意端口必须写80
3.docker pull mini1:80/dev/ngx:v1 -注意端口必须写80
4.docker tag mini1/dev/jdk1.8:v2 mini1:80/dev/jdk1.8:v3 -注意端口必须写80
5.docker push mini1:80/dev/jdk1.8:v3 -注意端口必须写80
上传成功如图:
image.png总结:
harbor对http方式支持不太好,哪个用户创建的仓库,使用哪个用户push pull
login pull push tag 操作必须带上mini1:80进行操作,才能操作成功
网友评论