安装依赖
apt install apache2-utils
设置密码
htpasswd -Bbn 用户名 密码 >/data/registry_hub/passwd
#docker私服部署
docker run -d -p 5000:5000 --name docker-registry -v /data/registry_hub/:/var/lib/registry -v /data/registry_hub/passwd:/auth/htpasswd \
-e "REGISTRY_AUTH=htpasswd" \
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-e "REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd" --restart=always --privileged=true registry:latest
#docker 镜像源配置
vi /etc/docker/daemon.json
{"registry-mirrors": ["https://docker.m.daocloud.io","https://dockerhub.timeweb.cloud","https://huecker.io"],
"insecure-registries":["http://ip:5000"]
}
docker_40">重启docker
systemctl restart docker
docker_44">docker私服地址
ip:5000用户名/密码
docker_ui_51">安装docker私服 ui页面
docker run --name registry-ui \-d \-p 1180:80 \-e SINGLE_REGISTRY=true \-e REGISTRY_TITLE="Docker Registry UI" \-e DELETE_IMAGES=true \-e SHOW_CONTENT_DIGEST=true \-e NGINX_PROXY_PASS_URL=http://ip:5000 \-e SHOW_CATALOG_NB_TAGS=true \-e CATALOG_MIN_BRANCHES=1 \-e CATALOG_MAX_BRANCHES=1 \-e TAGLIST_PAGE_SIZE=100 \-e REGISTRY_SECURED=false \-e CATALOG_ELEMENTS_LIMIT=1000 \joxit/docker-registry-ui:main
dockerui_71">docker私服ui地址
http://ip:1180用户名/密码
配置可以删除镜像
docker exec -it registry /bin/sh
/etc/docker/registry/config.yml
加入删除的操作,在storage下面
storage:delete:enabled: true
docker restart registry
docker_97">docker删除镜像
cd /data/registry_hub/具体的名称空间下
rm -rf ./*
docker restart docker-registry