docker registry

作者: ropon 分类: Docker 发布时间: 2022-01-27 14:12
  • 1、方法一 安装httpd-tools生成auth
    yum install httpd-tools
    htpasswd -Bbn devops codoon.com > /codoon/registry/auth/htpasswd
  • 2、方法二 registry:2.7.0 生成auth
    docker run --entrypoint htpasswd registry:2.7.0 -Bbn devops codoon.com > /codoon/registry/auth/htpasswd
  • 3、启动docker-registry2
    docker run -d -p 5000:5000 -v /codoon/registry/auth/:/auth/ -e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=basic-realm" -e "REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd" -v /codoon/registry/:/var/lib/registry/ registry:2.7.0
  • 4、还可以配置镜像存储到阿里OSS
    #通过环境变量配置 -e
    "REGISTRY_STORAGE_OSS_ACCESSKEYID=xxxx" "REGISTRY_STORAGE_OSS_ACCESSKEYSECRET=xxxxx"
    "REGISTRY_STORAGE_OSS_REGION=oss-cn-xxx"
    "REGISTRY_STORAGE_OSS_BUCKET=xxxxx"
    "REGISTRY_STORAGE_OSS_ENDPOINT=xxxxxx-internal.aliyuncs.com"
  • 5、常用api
    #查看镜像列表 n获取多少条
    /v2/_catalog?n=1000
    #获取某个镜像的tag列表
    /v2/image_name/tags/list

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!