centos创建docker私有仓库

创建私有docker仓库


安装docker repo
yum -y install docker-registry
修改docker repo 配置
$ cat /etc/docker-distribution/registry/config.yml
version: 0.1
log:
  fields:
    service: registry
storage:
    cache:
        layerinfo: inmemory
    filesystem:
        rootdirectory: /var/lib/registry  #镜像存储位置,可以修改成自己的
http:
    addr: :5000  #监听端口为5000
启动docker
systemctl start docker-distribution
systemctl enable docker-distribution
上传docker images
docker tag mysql:5.7.22 <IP>:5000/mysql:5.7.22
docker push docker-registry:5000/mysql:5.7.22
##如果推送报错需要
$ vim /etc/docker/daemon.json 
{
"registry-mirrors": ["docker-registry:5000"],
"insecure-registries": ["docker-registry:5000"]
}

##如果出现FATA[0000] Error response from daemon: v1 ping attempt failed with error: Get https://docker-registry:5000/v1/_ping: local error: record overflow. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry 10.121.136.139:5000` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/docker-registry:5000/ca.crt

$ vim /etc/default/docker
DOCKER_OPTS="$DOCKER_OPTS --insecure-registry=docker-registry:5000"
$ systemctl restart docker
启动docker repo
docker run -d -p 5000:5000 --restart=always -v /var/ftp/Docker/:/var/lib/registry registry
获取docker repo中的images列表
curl  http://docker-registry:5000/v2/_catalog
##列出images详情
curl -X GET http://docker-registry:5000/v2/ubuntu/tags/list
删除docker repo image
##delete_docker_registry_image 需要下载 wget https://raw.githubusercontent.com/burnettk/delete-docker-registry-image/master/delete_docker_registry_image.py | sudo tee /usr/local/bin/delete_docker_registry_image
export REGISTRY_DATA_DIR=/var/ftp/Docker/docker/registry/v2; delete_docker_registry_image --image ceph:1.3.1
harbor 管理iamges仓库
git clone https://github.com/goharbor/harbor.git
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值