拉取registry
镜像
$ docker pull registry
编辑配置文件config.yml
version: 0.1
log:
fields:
service: registry
storage:
delete:
enabled: true
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3
运行镜像
$ docker run -d -p 5000:5000 --restart=always --name registry -v /docker/registry/:/var/lib/registry/ -v /root/dockerhub/registry-config.yaml:/etc/docker/registry/config.yml registry
默认账号: admin
默认密码: Harbor123456
配置linux
安全策略
$ vim /etc/selinux/config
# 修改为以下值
SELINUX=disabled
否则会报错
Docker客户端配置私服
$ vim /etc/docker/daemon.json
添加:
{
"insecure-registries": ["hostname:5000"]
}
重启:
$ systemctl restart docker
hostname
为私服地址
发布镜像
# 打标签
$ docker tag yhbaas/peer:0.0.1 192.168.26.130:5000/yhbaas/peer:latest
# 提交
$ docker push 192.168.26.130:5000/yhbaas/peer:latest
拉取镜像
$ docker pull 192.168.26.130:5000/yhbaas/peer:latest
查看私服镜像
http://192.168.26.130:5000/v2/_catalog