在宿主机上搭建docker镜像仓库
一般来说搭建docker镜像仓库有两种办法:
- docker官方的:docker run -d -p 5000:5000 –name registry registry:2
- 用harbor,它在docker的那个仓库基础上增加了安全、访问控制和管理功能
我这里提供一种使用宿主机搭建docker镜像仓库的方法,执行文件提取自docker的那个仓库镜像,下载见:snfx8file.test.upcdn.net/docker/reg...
使用命令:./registry serve config.yml
,配置文件如下:
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: ~/docker/registry
auth:
htpasswd:
realm: basic-realm
path: ~/docker/htpasswd
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
host: https://localhost
http2:
disabled: false
tls:
certificate: ~/docker/localhost.pem
key: ~/docker/localhost.key
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3
启动后,日志会打印连接的用户名和密码,对应的加密认证文件在~/docker/htpasswd,访问查看仓库目录:127.0.0.1:5000/v2/_catalog
本作品采用《CC 协议》,转载必须注明作者和本文链接
参考 github.com/shunhua/dnmp