如何搭建 private docker registry

已通過期的 python 實現的版本的 docker registry,python

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

docker 1.6+ 後,支持並實現了 go 版本的 docker registry ( named docker distribution)github

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

部署本身的private docker distributionswift

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

用 docker 的方式跑 docker-registrymarkdown

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:11050ui

多個的話,就指定多個 --insecure-regsitry 參數,例如:--insecure-registry= xxx.xx.xx.xx:11050 --insecure-registry= xxx.xx.xx.xx:11050url

重啓docker service後,須要讓docker-registry自動運行,因此須要加上」–restart=always」參數。spa

採用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
相關文章
相關標籤/搜索