IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    构建docker私有库

    枯木 (1988.wulei@gmail.com)发表于 2014-06-04 17:08:00
    love 0

    为方便管理,我们需要对官方的镜像做一些定制,我们可以构建私有的docker registry

    快速构建

    The fastest way to get running:

    • install docker:apt-get install docker.io
    • run the registry: docker run -p 5000:5000 registry

    That will use the official image from the Docker index.[因为国内被墙的原因,速度比较慢,推荐第二种方式]

    传统构建方式

    1
    2
    3
    4
    5
    6
    
    $ sudo apt-get install build-essential python-dev libevent-dev python-pip liblzma-dev
    $ git clone https://github.com/dotcloud/docker-registry.git
    $ cd docker-registry/
    $ cp config/config_sample.yml config/config.yml
    $ mkdir /data/registry -p
    $ pip install .
    

    启动

    1
    2
    
    $ sudo gunicorn --access-logfile - --debug -k gevent -b 0.0.0.0:5000 \
    -w 1 docker_registry.wsgi:application
    

    生产环境可以通过如supervisord创建8个workers,或者通过nginx和apache来管理,具体可以参考docker-registry readme。

    1
    2
    
    $ sudo gunicorn -k gevent --max-requests 100 --graceful-timeout 3600 \
    -t 3600 -b localhost:5000 -w 8 docker_registry.wsgi:application
    

    提交指定容器到私有库

    1
    2
    
    $ docker tag 74fe38d11401 192.168.0.219:5000/ubuntu:12.04
    $ docker push 192.168.0.219:5000/ubuntu
    

    参考

    • docker-registry readme
    • How to use your own Registry

    –EOF–



沪ICP备19023445号-2号
友情链接