私有镜像库部署 原

###镜像库启动

docker run -d --net=host --restart=always --name=registry  -v /mnt/cephfs/registry/etc/htpasswd:/data/registry2/etc/htpasswd -v /mnt/cephfs/registry/etc/config.yml:/etc/docker/registry/config.yml  -v /mnt/cephfs/registry/data:/data/registry2/data --entrypoint="/bin/registry" registry:2.0 /etc/docker/registry/config.yml

###主要的配置文件

version: 0.1
log:
  level: warn
  formatter: text
  fields:
    service: registry
    environment: staging
storage:
  filesystem:
    rootdirectory: /data/registry2/data
  delete:
    enabled: true
  redirect:
    disable: false
  cache:
    blobdescriptor: inmemory
  maintenance:
    uploadpurging:
      enabled: true
      age: 168h
      interval: 24h
      dryrun: false
    readonly:
      enabled: false
auth:
  htpasswd:
    realm: basic-realm
    path: /data/registry2/etc/htpasswd
http:
  addr: 127.0.0.1:5000
  secret: xxxxxxxxxxxxxxxxxxxx
  headers:
    X-Content-Type-Options: [nosniff]
health:
  storagedriver:
    enabled: true
    interval: 10s
    threshold: 3

###密码的制作

docker run --entrypoint htpasswd registry:2.0 -Bbn user password > htpasswd

nginx前端代理

	upstream registry_prd_cluster {
		server 127.0.0.1:5000;
	}

	server {
		listen  80;
		server_name your_host;
		location / {
		    proxy_pass http://registry_prd_cluster;
		}
		access_log /data/logs/registry_access_log main;

	}

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

扫码关注云+社区

领取腾讯云代金券