美文网首页
创建docker仓库

创建docker仓库

作者: _艾_斯_ | 来源:发表于2019-12-11 15:38 被阅读0次

创建私有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://10.121.136.139: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/10.121.136.139:5000/ca.crt

$ vim /etc/default/docker
DOCKER_OPTS="$DOCKER_OPTS --insecure-registry=10.121.136.139: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://10.121.136.139:5000/v2/_catalog
##列出images详情
curl -X GET http://10.121.136.139: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

相关文章

网友评论

      本文标题:创建docker仓库

      本文链接:https://www.haomeiwen.com/subject/smoogctx.html