개발판 Docker와 Docker Registry의 검증 환경을 만들어 보세요.

13026 단어 docker_registryDocker
Docker Proive Registry라는 것이 있는데 Docker 이미지의 창고를 관리하는 데 사용됩니다.지금까지 docker/docker-registry 파이톤이 개발되었고 현재 버전은 0.9.1 이다.
이 docker-registry, Pythn을 사용하는 HTTP 서버가 bugy인지 push/pull인지 자주 실패하는 문제...
참고로 이 Docker Registry의 다음 버전은 Go의 스크래치로 개발되었습니다.창고도 옮겼다docker/distrbution.
최초 버전은 2.0으로 예상되며발매일은 2015-04-16 예정(서해안 시간일 수도).
왠지 기대가 되는 것 같아요
이registry v2는 API도 v1->v2로 올라가기 때문에 현재 발행된 Docker 1.5 이하는 지원되지 않습니다 (push/pull 불가).registry v2와 함께 릴리즈되는 Docker는 1.6부터 대응할 예정입니다.
===2015-04-1618:40 보충
대체로README.md Docker 1.5+ 지원이라고 쓰여있는데...
An implementation of the Docker Registry HTTP API V2 for use with docker 1.5+.
다만, 수중에 있는 Docker 1.5.0+registry v2.0.0-rc4를 통해 검증합니다. 다음 오류로push가 불가능합니다.
vagrant@vagrant:~$ docker push localhost:5000/wheezy
511136ea3c5a: Image push failed
FATA[0000] Error pushing to registry: mux: variable "wheezy" doesn't match, expected "^(?:[a-z0-9]+(?:[._-][a-z0-9]+)*/){1,4}[a-z0-9]+(?:[._-][a-z0-9]+)*$"
Docker 1.5+ 처리docker/distribution#327에 대해 논의했다.속보를 기다리다.
====2015-04-1702:00
1.5 is not supported.
Fixing the doc in #371
Blacklist 1.5 · Issue #327 · docker/distribution
그러니 Docker 1.6 발표를 기다립시다
= = 추기 종료
Docker 1.6 ®istry v2의 조합을 빨리 검증하고 싶어서 Ubuntu VM에 개발판 Docker 세트를 설치해 봤습니다.

Try Docker 1.6-rc & Docker Registry 2.0


필요한 물건


  • Vagrant
  • VirtualBox
  • 시험해 보다


    다음Vagrantfile 준비
    # -*- mode: ruby -*-
    # vi: set ft=ruby :
    
    # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
    VAGRANTFILE_API_VERSION = "2"
    
    Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
      config.vm.box = "opscode-ubuntu-14.04"
      config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box"
    end
    
    VM 시작
    $ vagrant up
    $ vagrant ssh
    
    개발 Docker 설치
    vagrant@vagrant:~$ wget -qO- https://test.docker.com/ | sh
    apparmor is enabled in the kernel and apparmor utils were already installed
    /sbin/apparmor_parser
    + [ https://get.docker.com/ = https://test.docker.com/ ]
    + [ https://test.docker.com/ = https://test.docker.com/ ]
    ...
    Remember that you will have to log out and back in for this to take effect!
    vagrant@vagrant:~$ sudo docker version
    Client version: 1.6.0-rc7
    Client API version: 1.18
    Go version (client): go1.4.2
    Git commit (client): 7e26e41
    OS/Arch (client): linux/amd64
    Server version: 1.6.0-rc7
    Server API version: 1.18
    Go version (server): go1.4.2
    Git commit (server): 7e26e41
    OS/Arch (server): linux/amd64
    
    sudo를 치는 것은 매우 번거롭기 때문에vagrant 사용자를 docker 그룹에 가입시킵니다
    도중에 잠시 취소해야 한다
    vagrant@vagrant:~$ sudo usermod -aG docker vagrant
    vagrant@vagrant:~$ logout # ログアウト必要!
    $ vagrant ssh
    vagrant@vagrant:~$ docker version
    Client version: 1.6.0-rc7
    Client API version: 1.18
    Go version (client): go1.4.2
    Git commit (client): 7e26e41
    OS/Arch (client): linux/amd64
    Server version: 1.6.0-rc7
    Server API version: 1.18
    Go version (server): go1.4.2
    Git commit (server): 7e26e41
    OS/Arch (server): linux/amd64
    
    이후 distribution/deploying.md 보면서 추진했다.
    Drocker Registry 2.0 구축 & 시작
    vagrant@vagrant:~$ git clone https://github.com/docker/distribution.git
    Cloning into 'distribution'...
    remote: Counting objects: 4506, done.
    remote: Compressing objects: 100% (8/8), done.
    remote: Total 4506 (delta 3), reused 0 (delta 0), pack-reused 4498
    Receiving objects: 100% (4506/4506), 1.84 MiB | 1.08 MiB/s, done.
    Resolving deltas: 100% (2351/2351), done.
    Checking connectivity... done.
    vagrant@vagrant:~$ cd distribution/
    vagrant@vagrant:~/distribution$ docker build -t registry .
    Sending build context to Docker daemon 5.838 MB
    Sending build context to Docker daemon
    Step 0 : FROM golang:1.4
    1.4: Pulling from golang
    d338bb63f151: Pull complete
    ...
     ---> Running in c6546a92ca33
     ---> fcac87db3f28
    Removing intermediate container c6546a92ca33
    Successfully built fcac87db3f28
    
    vagrant@vagrant:~/distribution$ docker run -d -p 5000:5000 --name registry registry
    ad80dfee5660b12d7466c9db221e66eff51b4502cffca49c6376ff2b72b8b7f4
    
    Registry 시작 & 소통 확인
    vagrant@vagrant:~/distribution$ docker ps
    CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS                    NAMES
    ad80dfee5660        registry:latest     "registry cmd/regist   50 minutes ago      Up 50 minutes       0.0.0.0:5000->5000/tcp   registry
    vagrant@vagrant:~/distribution$ wget -qO- localhost:5000/v2/
    {}
    
    공식 Hello World 이미지 하락, Registry v2에 대한 push 시도
    vagrant@vagrant:~$ docker run hello-world
    Unable to find image 'hello-world:latest' locally
    latest: Pulling from hello-world
    511136ea3c5a: Pull complete
    31cbccb51277: Pull complete
    e45a5af57b00: Already exists
    hello-world:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
    Digest: sha256:840559710d27cecc786ae6edc9ceb39e5d8697bb27b4c7917a404d7faaac83f0
    Status: Downloaded newer image for hello-world:latest
    Hello from Docker.
    This message shows that your installation appears to be working correctly.
    
    To generate this message, Docker took the following steps:
     1. The Docker client contacted the Docker daemon.
     2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
        (Assuming it was not already locally available.)
     3. The Docker daemon created a new container from that image which runs the
        executable that produces the output you are currently reading.
     4. The Docker daemon streamed that output to the Docker client, which sent it
        to your terminal.
    
    To try something more ambitious, you can run an Ubuntu container with:
     $ docker run -it ubuntu bash
    
    For more examples and ideas, visit:
     http://docs.docker.com/userguide/
    
    
    vagrant@vagrant:~/distribution$ docker tag hello-world:latest localhost:5000/hello-mine
    vagrant@vagrant:~/distribution$ docker push localhost:5000/hello-mine
    The push refers to a repository [localhost:5000/hello-mine] (len: 1)
    e45a5af57b00: Image already exists
    31cbccb51277: Image successfully pushed
    511136ea3c5a: Image successfully pushed
    Digest: sha256:a1b13bc01783882434593119198938b9b9ef2bd32a0a246f16ac99b01383ef7a
    
    Registry v2에서 pull 시작
    vagrant@vagrant:~/distribution$ docker pull localhost:5000/hello-mine
    latest: Pulling from localhost:5000/hello-mine
    
    31cbccb51277: Pull complete
    e45a5af57b00: Already exists
    511136ea3c5a: Already exists
    Digest: sha256:a1b13bc01783882434593119198938b9b9ef2bd32a0a246f16ac99b01383ef7a
    Status: Downloaded newer image for localhost:5000/hello-mine:latest
    
    vagrant@vagrant:~/distribution$ docker run localhost:5000/hello-mine
    Hello from Docker.
    This message shows that your installation appears to be working correctly.
    
    To generate this message, Docker took the following steps:
     1. The Docker client contacted the Docker daemon.
     2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
        (Assuming it was not already locally available.)
     3. The Docker daemon created a new container from that image which runs the
        executable that produces the output you are currently reading.
     4. The Docker daemon streamed that output to the Docker client, which sent it
        to your terminal.
    
    To try something more ambitious, you can run an Ubuntu container with:
     $ docker run -it ubuntu bash
    
    For more examples and ideas, visit:
     http://docs.docker.com/userguide/
    

    REF

  • docker/docker
  • docker/distribution
  • distribution/deploying.md
  • 좋은 웹페이지 즐겨찾기