wiki:jazz/15-02-23

Version 4 (modified by jazz, 10 years ago) (diff)

--

2015-02-23

Docker

  • 搭建私人的 Docker Regristry
  • [參考] https://www.digitalocean.com/community/tutorials/how-to-set-up-a-private-docker-registry-on-ubuntu-14-04
  • [參考] https://beingasysadmin.wordpress.com/2015/01/14/setting-up-docker-private-registry/
  • [步驟]
    jazz@Workshop:~$ sudo apt-get -y install build-essential python-dev libevent-dev python-pip liblzma-dev libssl-dev swig
    jazz@Workshop:~$ sudo pip install docker-registry
    jazz@Workshop:~$ cd /usr/local/lib/python2.7/dist-packages/config
    jazz@Workshop:/usr/local/lib/python2.7/dist-packages/config$ sudo cp config_sample.yml config.yml
    jazz@Workshop:/usr/local/lib/python2.7/dist-packages/config$ cd 
    jazz@Workshop:~$ sudo mkdir /var/docker-registry
    jazz@Workshop:~$ sed -i 's#/tmp/docker-registry.db#/var/docker-registry/docker-registry.db#g' /usr/local/lib/python2.7/dist-packages/config/config.yml
    jazz@Workshop:~$ sudo sed -i 's#/tmp/registry#/var/docker-registry/registry#g' /usr/local/lib/python2.7/dist-packages/config/config.yml
    jazz@Workshop:~$ sudo mkdir -p /var/log/docker-registry
    jazz@Workshop:~$ cat > docker-registry.conf << EOF
    description "Docker Registry"
    
    start on runlevel [2345]
    stop on runlevel [016]
    
    respawn
    respawn limit 10 5
    
    script
    exec gunicorn --access-logfile /var/log/docker-registry/access.log --error-logfile /var/log/docker-registry/server.log -k gevent --max-requests 100 --graceful-timeout 3600 -t 3600 -b localhost:5000 -w 8 docker_registry.wsgi:application
    end script
    EOF
    jazz@Workshop:~$ sudo mv docker-registry.conf /etc/init/
    jazz@Workshop:~$ sudo service docker-registry start