docker私有仓库
搜索私有仓库
docker search registry --limit 1
docker pull registry
以容器的方式运行
docker run -d -p 5000:5000 --restart=always --name registry-test registory
仓库容器 存放镜像的目录在/var/lib/registry 下 可以用-v指定在宿主机目录挂载
通过docker push 命令上传到私有仓库
上传前需要给镜像名改成固定格式标签 ip:port/container_name:版本
eg: docker tag alpine:latest 127.0.0.1:5000/alpine:latest
docker push 127.0.0.1:5000/alpine:latest
用curl命令查看私有仓库镜像
curl 127.0.0.1:5000/v2/_catalog
拉取私有仓库镜像
docker pull 127.0.0.1:5000/alpine:latest
pull远程私有仓库
1.需要更改 /etc/docker/daemon.json
{ “insecure-registries”: [ “www.sharkyun.com:5000” ] }
- 在/lib/systemd/system/docker.service中添加
EnvironmentFile=-/etc/docker/daemon.json
执行如下命令进行重启
systemctl daemon-reload
systemclt restart docker
docker tag alpine:latest www.sharkyun.com:5000/alpine:jiang
docker push www.sharkyun.com/alpine:jiang