标签:空间 形式 secure dir rest memory etc content file
设置登录鉴权操作搭建参考:
https://blog.csdn.net/shida_csdn/article/details/78435971
参考指南:https://blog.51cto.com/ganbing/2080140
服务端机器 (主机名为registry):docker私有仓库服务器,运行registry容器;
节点机器 (主机名为node):普通的docker服务器,在这台服务器上可以上传和下载镜像;
docker pull registry
docker run --entrypoint htpasswd docker.io/registry:latest -Bbn hy 000000 >> /data/docker-registry/auth/htpasswd
# mkdir -p /opt/registry-var/config
# vim /opt/registry-var/config/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 /data/docker-registry/config/:/etc/docker/registry/ \
-v /data/docker-registry/auth/:/auth/ \
-e "REGISTRY_AUTH=htpasswd" \
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
-v /data/docker-registry/:/var/lib/registry/ \
docker.io/registry:latest
vim /etc/docker/daemon.json
{
"log-driver": "json-file",
"registry-mirrors":["55.18.67.171:5000"],
"insecure-registries":["55.18.67.171:5000"]
}
# systemctl daemon-reload
# systemctl restart docker
docker pull docker.io/hello-world
docker tag docker.io/hello-world:latest 55.18.67.171:5000/hello-word:latest
docker login 55.18.67.171:5000 -u hy -p 000000
docker push 55.18.67.171:5000/hello-word:latest
curl -u hy:000000 http://55.18.67.171:5000/v2/_catalog
默认default命名空间使用的secret
kubectl create secret docker-registry 10.10.10.149 --docker-server=55.18.67.171:5000 --docker-username=hy --docker-password=000000 --docker-email=niewx@ruyi.ai
hy-uat命名空间使用的secret
kubectl create secret docker-registry 10.10.10.149 --docker-server=55.18.67.171:5000 –namespace=hy-uat --docker-username=hy --docker-password=000000 --docker-email=niewx@ruyi.ai
curl -u hy:000000 http://55.18.67.171:5000/v2/_catalog
curl -u hy:000000 http://55.18.67.171:5000/v2/company-ner/tags/list
标签:空间 形式 secure dir rest memory etc content file
原文地址:https://www.cnblogs.com/niewx5201314/p/11663081.html