15.Docker仓库——Docker Registry

Docker仓库——Docker Registry

官方文档:https://docs.docker.com/registry/

官方github地址:https://github.com/docker/distribution

下载Docker registry

docker pull registry

创建单机仓库

#创建授权使用目录
mkdir /docker/auth
#创建用户
docker run --entrypoint htpasswd registry -Bbn jack 123456 > /docker/auth/htpasswd
#验证
cat /docker/auth/htpasswd

启动docker容器

docker run -d -p 5000:5000 --name registry -v /docker/auth:auth -e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" -e REGISTRY_AUTH_PASSWD_PATH=/auth/htpasswd registry

验证端口

ss -anlpt |grep 5000

添加证书信任

dockerd --help | grep insecure
vim /lib/systemd/system/docker.service
#添加 
Execstart=/usr/bin/docker -H fd:// --containerd-/run/containerd/containerd.sock --insecure-registry 172.20.1.102:5000
#重启docker
systemctl daemon-reload && ststemctl restart docker

上传测试

docker images
docker tag haproxy:2.0.13-centos 172.20.1.102:5000/status/haproxy:2.0.13-centos
docker push 172.20.1.102:5000/status/haproxy:2.0.13-centos
#下载 
docker pull 172.20.1.102:5000/status/haproxy:2.0.13-centos

登录信息存放在

vim /root/.docker/config.json
posted @ 2021-01-17 16:16  Gmiao  阅读(104)  评论(0编辑  收藏  举报