如何搭建 private docker registry

已经过期的 python 实现的版本的 docker registry,

https://github.com/docker/docker-registry

docker 1.6+ 后,支持并实现了 go 版本的 docker registry ( named docker distribution)

https://github.com/docker/distribution/blob/master/ROADMAP.md

部署自己的private docker distribution

https://github.com/docker/docker.github.io/blob/master/registry/deploying.md

用 docker 的方式跑 docker-registry

docker run -d --restart=always -p 10500:10500 --volume=/etc/docker-distribution/registry/config.yml:/etc/docker-distribution/registry/config.yml --name registry registry:2 /etc/docker-distribution/registry/config.yml

然后记住,需要修改docker daemon的启动配置(/etc/sysconfig/docker), –insecure-registry= xxx.xx.xx.xx:11050

多个的话,就指定多个 --insecure-regsitry 参数,例如:--insecure-registry= xxx.xx.xx.xx:11050 --insecure-registry= xxx.xx.xx.xx:11050

重启docker service后,需要让docker-registry自动运行,所以需要加上”–restart=always”参数。

采用swift做为后端存储

cat /etc/docker-distribution/registry/config.yml

version: 0.1

log:

  level: info

  fields:

    service: registry

loglevel: debug

storage:

  swift:

    username: dockerxxx

    password: dockerxxx

    authurl: http://10.209.196.2:5000/v2.0

    tenant: dockerxxxx@xxxx

    tenantid: 0d63c0f6ffd3458084cf5d2d7f2da4cd

    insecureskipverify: true

    region: RegionOne

    container: dockerregistry-test

  delete:

    enabled: true

http:

  addr: :10500

  secret: registry

  headers:

    X-Content-Type-Options: [nosniff]

health:

  storagedriver:

    enabled: true

    interval: 10s

    threshold: 3

notifications:

  endpoints:

    - name: alistener

      disabled: false

      url: http://10.209.224.17:10091/events

      timeout: 5s

      threshold: 5

      backoff: 5s
posted @ 2017-01-05 18:36  chenqiangzhishen  阅读(140)  评论(0编辑  收藏  举报