公有仓库:docker hub
私有仓库:registry
建议生产仓库:harbor
https://blog.csdn.net/qq_24095941/article/details/86063684
Harbor
这是VMWare公司提供的一个docker私有仓库构建程序,功能非常强大.
1. 支持多租户签名和认证
2. 支持安全扫描和风险分析
3. 这次日志审计
4. 基于角色的访问控制
5. 支持可扩展的API和GUI
6. Image replication between instances
7. 国际化做的很好(目前仅支持英文和中文)
[root@localhost ~]# cd harbor/
[root@localhost harbor]# ls
common.sh harbor.v1.10.4.tar.gz harbor.yml install.sh LICENSE prepare
[root@localhost harbor]# vi harbor.yml
修改hostname,注释https:
# 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: 192.168.1.102# 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: https://reg.mydomain.com:8433# 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
启动:./install.sh
访问 ip+端口,输入账户密码(配置文件上有密码):
由于harbor配置的是http访问,docker是https,所以所以需要修改 docker 配置,将信任的库的地址写上
修改文件 /etc/docker/daemon.json
{
"insecure-registries": [
"192.168.1.102"
]
}
systemctl restart docker
docker tag nginx:latest 192.168.1.102/test/nginx:latest
docker push 192.168.1.102/test/nginx:latest
上传镜像成功!