DockerHub加速及私有鏡像搭建&RESTAPI

Docker Hub加速及私有鏡像搭建& REST  API


daocloud加速
說明:國內的daocloud,時速雲( tenxcloud.com),靈雀雲( http://www.alauda.cn/)都只是一部分同步Docker Hub官方,但聊勝於無
1.安裝docker
2.註冊並登陸daocloud帳號
DockerHub加速及私有鏡像搭建&RESTAPI

3.配置加速
A.加速2.0(安裝daomonit)
實現加速後,只要本地網速夠快,下載速度能夠達到1MB哦,比Docker Hub官方已經快上N個級別了,實測,1分鐘內便可pull完ubuntu:16.04

curl -sSL https://get.daocloud.io/daomonit/install.sh | sh -s 25862a99e83db9287676008adbb7c38f10dea220

[root@ct7 ~]# dao pull ubuntu:16.04html

Dao from DaoCloudpython

Initializing, Please wait a minutelinux

Using default tag: latestgit

latest: Pulling from daocloud/daocloud-toolsetgithub


efd26ecc9548: Pull complete golang

a3ed95caeb02: Pull complete web

2719467b8a13: Pull complete redis

b77ed3a436e2: Pull complete docker

Digest: sha256:09de57ef521f2d8c056b95bafc36ccbcb900b3bdcd5e5c917714d26fca26e944json

Status: Downloaded newer image for daocloud.io/daocloud/daocloud-toolset:latest

Inital Success



# ----------------------------------------------------------------------------

# DaoCloud ToolBox for Docker

#

# DaoCloud, Inc. (c) 2016

#

# Fastest way to pull image from Docker Hub

# ----------------------------------------------------------------------------


Pulling repository library/ubuntu:16.04 

ac6ad7efd0f9: Download complete                                                                     a3ed95caeb02: Download complete                                                                                Download complete                                                                     5ba4f30e5bea: Download complete                                                                                   Download complete                                                                     Pull library/ubuntu:16.04 complete, you can find it with 'docker images'   

[root@ct7 ~]# docker images

REPOSITORY                              TAG                 IMAGE ID            CREATED             SIZE

ubuntu                                  16.04               1cdafc116f5e        12 days ago         122 MB

daocloud.io/daocloud/daocloud-toolset   latest              1ab33797d8a1        6 weeks ago         150.2 MB


B.加速1.0(推薦)

加速1.0更容易明白加速原理,也更原生些。其實是啓動docker daemon時經過--registry-mirror優先指定Registry,能夠指定多條

sed -i 's#fd://#fd:// --registry-mirror http://1257c036.m.daocloud.io#' /lib/systemd/system/docker.service

systemctl daemon-reload

systemctl restart docker


[root@ct7 ~]# systemctl status docker

docker.service - Docker Application Container Engine

   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)

   Active: active (running) since 四 2016-06-09 02:10:00 CST; 9min ago

     Docs: https://docs.docker.com

 Main PID: 14191 (docker)

   CGroup: /system.slice/docker.service

           ├─14191 /usr/bin/docker daemon -H fd:// --registry-mirror http://1257c036.m.daocloud.i...

           └─14196 docker-containerd -l /var/run/docker/libcontainerd/docker-containerd.sock --ru...


6月 09 02:10:00 ct7.example.com docker[14191]: time="2016-06-09T02:10:00.987206124+08:00" lev...nd"

6月 09 02:10:00 ct7.example.com docker[14191]: time="2016-06-09T02:10:00.987503747+08:00" lev...t."

6月 09 02:10:00 ct7.example.com docker[14191]: time="2016-06-09T02:10:00.987564135+08:00" lev...e."

6月 09 02:10:00 ct7.example.com docker[14191]: time="2016-06-09T02:10:00.987573388+08:00" lev...on"

6月 09 02:10:00 ct7.example.com docker[14191]: time="2016-06-09T02:10:00.987583790+08:00" lev...1.2

6月 09 02:10:00 ct7.example.com docker[14191]: time="2016-06-09T02:10:00.992688671+08:00" lev...ck"

6月 09 02:10:00 ct7.example.com systemd[1]: Started Docker Application Container Engine.

6月 09 02:10:25 ct7.example.com docker[14191]: time="2016-06-09T02:10:25.881743515+08:00" lev...wn"

6月 09 02:10:43 ct7.example.com docker[14191]: time="2016-06-09T02:10:43.704859767+08:00" lev...ed"

6月 09 02:10:46 ct7.example.com docker[14191]: time="2016-06-09T02:10:46.772210349+08:00" lev...nd"

 

Hint: Some lines were ellipsized, use -l to show in full.




搭建私有Registry2.x

A.Docker Hub官方Registry容器

1.運行registry容器(run)

docker run -d -p 5000:5000 --restart=always --name registry -v /var/lib/docker/registry:/var/lib/registry registry:2

說明:前提docker版本要1.6或更新,運行後會自動下載並啓動一個registry容器。默認會將倉庫建立在容器的/tmp/registry目錄下,-v 參數能夠指定鏡像文件存放的本地的路徑

[root@ct7 ~]# docker version

Client:

 Version:      1.11.2

 API version:  1.23

 Go version:   go1.5.4

 Git commit:   b9f10c9

 Built:        Wed Jun  1 21:23:11 2016

 OS/Arch:      linux/amd64


Server:

 Version:      1.11.2

 API version:  1.23

 Go version:   go1.5.4

 Git commit:   b9f10c9

 Built:        Wed Jun  1 21:23:11 2016

 OS/Arch:      linux/amd64

[root@ct7 ~]# docker run -d -p 5000:5000 --restart=always --name registry -v /var/lib/docker/registry:/var/lib/registry registry:2

Unable to find image 'registry:2' locally

2: Pulling from library/registry

51f5c6a04d83: Pull complete 

a3ed95caeb02: Pull complete 

c8064261a06d: Pull complete 

619635144a24: Pull complete 

c0275d66d860: Pull complete 

Digest: sha256:33ea1d7ad2af5ac5d984fe34a6491ce1505f11e46a60dbf99147a5879407d703

Status: Downloaded newer image for registry:2

f099ef927cbf4e56b6479647adc68060d67ce9f17c9f7e4ecdb660f05254ca74

[root@ct7 ~]# docker ps

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES

f099ef927cbf        registry:2          "/bin/registry serve "   3 minutes ago       Up 3 minutes        0.0.0.0:5000->5000/tcp   registry

[root@ct7 ~]# netstat -tunlp|grep docker

tcp6           0 :::5000                 :::*                    LISTEN      2661/docker-proxy 


圖形界面 https://hub.docker.com/r/hyper/docker-registry-web/


2.獲取image(pull)

docker pull ubuntu:16.04


[root@ct7 ~]# docker pull ubuntu:16.04

16.04: Pulling from library/ubuntu

5ba4f30e5bea: Pull complete 

9d7d19c9dc56: Pull complete 

ac6ad7efd0f9: Pull complete 

e7491a747824: Pull complete 

a3ed95caeb02: Pull complete 

Digest: sha256:f5edf3b741a08b573eca6bf25257847613540538a17b86e2b76e14724a0be68a

Status: Downloaded newer image for ubuntu:16.04

3.將獲取到的image tag到私有registry(tag)

docker tag ubuntu:16.04 localhost:5000/ubuntu:16.04

4.將獲取到的image push到私有registry(push)

docker push localhost:5000/ubuntu:16.04


[root@ct7 ~]# docker push localhost:5000/ubuntu:16.04

The push refers to a repository [localhost:5000/ubuntu]

5f70bf18a086: Pushed 

737f40e80b7f: Pushed 

82b57dbc5385: Pushed 

19429b698a22: Pushed 

9436069b92a3: Pushed 

16.04: digest: sha256:4cd13bd37c4cc65e03cec3701b447654a979291c6e1fde25d40023ad37876d34 size: 1356

5.stop/rm registry容器

中止registry容器

docker stop registry 

刪除registry容器

docker rm -fv registry

6.指定docker私有鏡像

https://docs.docker.com/engine/reference/commandline/daemon/#insecure-registries

sed -i 's#fd://#fd:// --registry-mirror http://192.168.8.254:5000 --insecure-registry 192.168.8.254:5000#' /lib/systemd/system/docker.service

systemctl daemon-reload

systemctl restart docker

注意:若是私有registry沒有TLS加密,則客戶端在啓動docker時要加上--insecure-registry參數,不然pull,push等都會失敗

[root@ct7 ~]# docker pull 192.168.8.254:5000/ubuntu:14.04

Error response from daemon: Get https://192.168.8.254:5000/v1/_ping: tls: oversized record received with length 20527

配置正確的話,會以下輸出

[root@ct7 ~]# docker pull 192.168.8.254:5000/centos:7

7: Pulling from centos


488a93afa07d: Pull complete 

Digest: sha256:88dcdb9b54988129d4b63d984236f9b14dcc0c2dd1f77cd33d3673d888c18079

Status: Downloaded newer image for 192.168.8.254:5000/centos:7

[root@ct7 ~]# docker images

REPOSITORY                  TAG                 IMAGE ID            CREATED             SIZE

192.168.8.254:5000/centos   7                   7d957a47f7fd        About an hour ago   434.8 MB

[root@ct7 ~]# docker run -t -i 192.168.8.254:5000/centos:7 /bin/bash

或者直接

[root@ct7 ~]# docker run -dti 192.168.8.254:5000/centos:7 /bin/bash

Unable to find image '192.168.8.254:5000/centos:7' locally

7: Pulling from centos


488a93afa07d: Pull complete 

Digest: sha256:88dcdb9b54988129d4b63d984236f9b14dcc0c2dd1f77cd33d3673d888c18079

Status: Downloaded newer image for 192.168.8.254:5000/centos:7

2fcd581979e9be74cf15b51b3e29c96a930b2a57075aee21bac577ab5eec4049

[root@ct7 ~]# docker ps

CONTAINER ID        IMAGE                         COMMAND             CREATED              STATUS              PORTS               NAMES

2fcd581979e9        192.168.8.254:5000/centos:7   "/bin/bash"         About a minute ago   Up About a minute                       prickly_northcutt

 

[root@ct7 ~]# docker attach 2fcd581979e9

[root@243ae3584729 /]# cd

[root@243ae3584729 ~]# uname -a

Linux 243ae3584729 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

[root@243ae3584729 ~]# cat /etc/redhat-release 

CentOS Linux release 7.2.1511 (Core) 

[root@243ae3584729 ~]# ip a

1: lo: mtu 65536 qdisc noqueue state UNKNOWN 

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 scope host lo

       valid_lft forever preferred_lft forever

    inet6 ::1/128 scope host 

       valid_lft forever preferred_lft forever

4: eth0: mtu 1500 qdisc noqueue state UP 

    link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff

    inet 172.17.0.2/16 scope global eth0

       valid_lft forever preferred_lft forever

    inet6 fe80::42:acff:fe11:2/64 scope link 

       valid_lft forever preferred_lft forever

7.導入image

若是以爲官方鏡像慢除了指定國內docker鏡像源加速外還能夠自行打包鏡像或藉助開源模板 http://openvz.org/Download/template/precreated
openvz的鏡像雖不算快,但比docker官方站點要快許多

cat centos-7-x86_64-minimal.tar.gz|docker importcentos:7
docker tag centos:7 localhost:5000/centos:7
docker push localhost:5000/centos:7

docker import ubuntu-14.04-x86_64-minimal.tar.gz ubuntu:14.04

docker tag ubuntu:14.04 localhost:5000/ubuntu:14.04

docker push localhost:5000/ubuntu:14.04


docker import http://download.openvz.org/template/precreated/ubuntu-16.04-x86_64.tar.gz ubuntu:16.04

docker tag ubuntu:16.04 localhost:5000/ubuntu:16.04

docker push localhost:5000/ubuntu:16.04


提示:導入本地鏡像須要先import--->tag--->push

root@router:~#docker import  centos-7-x86_64-minimal.tar.gz centos:7

sha256:7d957a47f7fd2a7ea8353e452e9cbda56c22724cff925094b0a078bfd14c5a21

root@router:~#docker tag centos:7 localhost:5000/centos:7

root@router:~#docker push localhost:5000/centos:7

The push refers to a repository [localhost:5000/centos]

6e6b57f1d84d: Pushed 

7: digest: sha256:88dcdb9b54988129d4b63d984236f9b14dcc0c2dd1f77cd33d3673d888c18079 size: 529

8.運行容器

docker run -i -t localhost:5000/centos:7 /bin/bash


root@router:~#docker run -i -t localhost:5000/centos:7 /bin/bash

[root@ce2171a92f1b /]# uname -a

Linux ce2171a92f1b 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

[root@da2ea9c701dc /]# cat /etc/redhat-release 

CentOS Linux release 7.2.1511 (Core) 

[root@ce2171a92f1b /]# w

 09:00:17 up  1:41,  0 users,  load average: 0.01, 0.08, 0.12

USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT

[root@ce2171a92f1b /]# df -h

Filesystem                                                                                        Size  Used Avail Use% Mounted on

/dev/mapper/docker-8:1-25168265-1da6fb8109b9cfb53a32d0711bc107264c01ec8303c26cc1d1bf705b60606e4d   10G  481M  9.6G   5% /

tmpfs                                                                                             5.8G     5.8G   0% /dev

tmpfs                                                                                             5.8G     5.8G   0% /sys/fs/cgroup

/dev/sda1                                                                                         8.0G  7.7G  387M  96% /etc/hosts

shm                                                                                                64M     0   64M   0% /dev/shm


B.daemon方式Docker Registry 2.0DockerHub加速及私有鏡像搭建&RESTAPI

說明:以前的docker-registry(基於python)已經廢止,最新項目轉爲docker-distribution(基於Go>=1.5)

WARNING

Notice: The classical python "Docker Registry" is deprecated, in favor of a new golang implementation. This here is kept for historical purpose, and will not receive any significant work/love any more. You should head to the landing page of the new registry or  the "Distribution" github project instead.

This repository's main product is the Docker Registry 2.0 implementation for storing and distributing Docker images. It supersedes the docker/docker-registry project with a new API design, focused around security and performance.


yum安裝

yum -y install docker-distribution

systemctl enable docker-distribution

systemctl start docker-distribution


[root@ct7 ~]# systemctl status docker-distribution

docker-distribution.service - v2 Registry server for Docker

   Loaded: loaded (/usr/lib/systemd/system/docker-distribution.service; disabled; vendor preset: disabled)

   Active: active (running) since 六 2016-06-11 20:20:58 CST; 2s ago

 Main PID: 2400 (registry)

   Memory: 4.1M

   CGroup: /system.slice/docker-distribution.service

           └─2400 /usr/bin/registry serve /etc/docker-distribution/registry/config.yml


6月 11 20:20:58 ct7.example.com systemd[1]: Started v2 Registry server for Docker.

6月 11 20:20:58 ct7.example.com systemd[1]: Starting v2 Registry server for Docker...

6月 11 20:20:58 ct7.example.com registry[2400]: time="2016-06-11T20:20:58+08:00" level=warning m...

6月 11 20:20:58 ct7.example.com registry[2400]: time="2016-06-11T20:20:58+08:00" level=info m...wn"

6月 11 20:20:58 ct7.example.com registry[2400]: time="2016-06-11T20:20:58+08:00" level=info m...wn"

6月 11 20:20:58 ct7.example.com registry[2400]: time="2016-06-11T20:20:58+08:00" level=info m...wn"

6月 11 20:20:58 ct7.example.com registry[2400]: time="2016-06-11T20:20:58+08:00" level=info m...wn"

Hint: Some lines were ellipsized, use -l to show in full.

[root@ct7 ~]# ps -ef|grep distribution

root      2400     0 20:20 ?        00:00:00 /usr/bin/registry serve /etc/docker-distribution/registry/config.yml

root      2407  1890  0 20:21 pts/0    00:00:00 grep --color=auto distribution

[root@ct7 ~]# netstat -tunlp|grep registry

tcp6           0 :::5000                 :::*                    LISTEN      2400/registry

或者

源碼安裝

1.升級go(>=1.5)

wget http://www.golangtc.com/static/go/1.6.2/go1.6.2.linux-amd64.tar.gz

tar -xvf go1.6.2.linux-amd64.tar.gz -C /opt

sudo cat >>/etc/profile <<'HERE'

export GOROOT=/opt/go

export GOPATH=/var/tmp/go

export PATH=$GOROOT/bin:$PATH

HERE

source /etc/profile

 

提示:主要設置GOROOT(安裝路徑),GOPATH(go項目的存放位置,自定義)

root@router:~#go version

go version go1.6.2 linux/amd64

2.安裝docker-distribution

go get -v github.com/docker/distribution/cmd/registry

一條命令自動git並編譯安裝好,這裏的版本是2.4.1

[root@ct7 ~]# $GOPATH/bin/registry -v

/var/tmp/go/bin/registry github.com/docker/distribution v2.4.1+unknown

3.啓動docker-distribution

mkdir /var/lib/registry #存放registry的目錄必定要存在,不然,在上傳image的時候會報503錯誤

cd $GOPATH

./bin/registry serve .src/github.com/docker/distribution/cmd/registry/config-example.yml 

看到以下結果,說明docker-distribution成功運行,默認監聽在5000端口,配置文件能夠根據模板(config-example.yml)來自定義

最好是放到後臺執行

[root@ct7 go]# pwd

/var/tmp/go

[root@ct7 go]# ./bin/registry serve ./src/github.com/docker/distribution/cmd/registry/config-example.yml 

WARN[0000] No HTTP secret provided - generated random secret. This may cause problems with uploads if multiple registries are behind a load-balancer. To provide a shared secret, fill in http.secret in the configuration file or set the REGISTRY_HTTP_SECRET environment variable.  go.version=go1.6.2 instance.id=9202f4fe-770a-4b6b-b8b5-fd5f39d1bff5 version=v2.4.1+unknown

INFO[0000] redis not configured                          go.version=go1.6.2 instance.id=9202f4fe-770a-4b6b-b8b5-fd5f39d1bff5 version=v2.4.1+unknown

INFO[0000] Starting upload purge in 11m0s                go.version=go1.6.2 instance.id=9202f4fe-770a-4b6b-b8b5-fd5f39d1bff5 version=v2.4.1+unknown

INFO[0000] using inmemory blob descriptor cache          go.version=go1.6.2 instance.id=9202f4fe-770a-4b6b-b8b5-fd5f39d1bff5 version=v2.4.1+unknown

INFO[0000] listening on [::]:5000                        go.version=go1.6.2 instance.id=9202f4fe-770a-4b6b-b8b5-fd5f39d1bff5 version=v2.4.1+unknown

[root@ct7 ~]# netstat -tunlp|grep registry

tcp6           0 :::5000                 :::*                    LISTEN      3190/./bin/registry


https://docs.docker.com/registry/configuration/#list-of-configuration-options

配置示例https://github.com/docker/distribution/blob/master/docs/configuration.md#storage

cat ./src/github.com/docker/distribution/cmd/registry/config-example.yml 

version: 0.1

log:

  fields:

    service: registry

storage:

  cache:

    blobdescriptor: inmemory

  filesystem:

    rootdirectory: /var/lib/registry

http:

  addr: :5000

  headers:

    X-Content-Type-Options: [nosniff]

health:

  storagedriver:

    enabled: true

    interval: 10s

    threshold: 3



REST API

https://docs.docker.com/registry/spec/api/

http://docker-py.readthedocs.io/en/latest/api/


1.查看repo列表

root@router:~#curl -XGET http://192.168.8.254:5000/v2/_catalog

{"repositories":["centos","consul","elasticsearch","gliderlabs/registrator","rethinkdb","shipyard/shipyard","swarm","ubuntu","zookeeper"]}

2.查看repo中的tag列表

root@router:~#curl -XGET http://192.168.8.254:5000/v2/swarm/tags/list

{"name":"swarm","tags":["latest"]}

root@router:~#curl -XGET http://192.168.8.254:5000/v2/consul/tags/list

{"name":"consul","tags":["0.6.4","latest"]}

3.刪除鏡像

docker官方鑑於v2 版設計的安全性與開發需求成本和磁盤的廉價性,至今沒有出和v2相似直接刪除並釋放磁盤空間的方法,以致於你第三方的shipyard等目前也只支持v1倉庫,這裏簡單介紹一種刪除的方法

i.啓用registry刪除並重啓

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

version: 0.1 

log:

  fields:

    service: registry

storage:

    delete:

        enabled: true

    cache:

        layerinfo: inmemory

    filesystem:

        rootdirectory: /var/lib/libvirt/images/registry

http: 

    addr: :5000

systemctl restart docker-distribution

在storage段啓用delete

ii.查找到對應image的Digest

Note When deleting a manifest from a registry version 2.3 or later, the following header must be used when HEAD or GET-ing the manifest to obtain the correct digest to delete:

Accept: application/vnd.docker.distribution.manifest.v2+json

注意: 刪除時必定要帶上v2的Header,不然會刪除失敗


root@router:~#curl -I -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X GET 192.168.8.254:5000/v2/alpine/manifests/latest

HTTP/1.1 200 OK

Content-Length: 528

Content-Type: application/vnd.docker.distribution.manifest.v2+json

Docker-Content-Digest: sha256:4b8403bacd7f331e2016aaebb92daf955a9b86576c7584e969a9c0f2e4cfa8e7

Docker-Distribution-Api-Version: registry/2.0

Etag: "sha256:4b8403bacd7f331e2016aaebb92daf955a9b86576c7584e969a9c0f2e4cfa8e7"

Date: Fri, 14 Oct 2016 00:16:37 GM

上面是帶了v2頭的,下面是沒帶v2頭的,二者的Digest值明顯不一樣,這也是不少同窗在刪除的時候出現UNKNOWN MANIFEST的錯誤提示的緣由。

root@router:~#curl -I -X GET 192.168.8.254:5000/v2/alpine/manifests/latest

HTTP/1.1 200 OK

Content-Length: 2133

Content-Type: application/vnd.docker.distribution.manifest.v1+prettyjws

Docker-Content-Digest: sha256:df73ed0973f15f40496c148330f9b559f0a5583c03f6ac8d26adadf6f4690aff

Docker-Distribution-Api-Version: registry/2.0

Etag: "sha256:df73ed0973f15f40496c148330f9b559f0a5583c03f6ac8d26adadf6f4690aff"

Date: Fri, 14 Oct 2016 00:17:41 GMT

iii.API刪除

root@router:~#curl -I -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X DELETE 192.168.8.254:5000/v2/alpine/manifests/sha256:4b8403bacd7f331e2016aaebb92daf955a9b86576c7584e969a9c0f2e4cfa8e7

HTTP/1.1 202 Accepted

Docker-Distribution-Api-Version: registry/2.0

Date: Fri, 14 Oct 2016 00:24:06 GMT

Content-Length: 0

Content-Type: text/plain; charset=utf-8

iv.垃圾回收

root@router:~#registry garbage-collect /etc/docker-distribution/registry/config.yml

INFO[0000] Deleting blob: /docker/registry/v2/blobs/sha256/4b/4b8403bacd7f331e2016aaebb92daf955a9b86576c7584e969a9c0f2e4cfa8e7  go.version=go1.4.2 instance.id=51bf4ba4-6e9c-4851-a684-da75ed8615d1

INFO[0000] Deleting blob: /docker/registry/v2/blobs/sha256/c0/c0cb142e43453ebb1f82b905aa472e6e66017efd43872135bc5372e4fac04031  go.version=go1.4.2 instance.id=51bf4ba4-6e9c-4851-a684-da75ed8615d1

INFO[0000] Deleting blob: /docker/registry/v2/blobs/sha256/ee/ee4603260daafe1a8c2f3b78fd760922918ab2441cbb2853ed5c439e59c52f96  go.version=go1.4.2 instance.id=51bf4ba4-6e9c-4851-a684-da75ed8615d1

DockerHub加速及私有鏡像搭建&RESTAPI

python腳本 https://github.com/liujun1990/python/blob/master/available/dockerRegistryV2.py



A list of methods and URIs are covered in the table below:

Method Path Entity Description
GET /v2/ Base Check that the endpoint implements Docker Registry API V2.
GET /v2//tags/list Tags Fetch the tags under the repository identified by name.
GET /v2//manifests/ Manifest Fetch the manifest identified by name and referencewhere referencecan be a tag or digest. A HEADrequest can also be issued to this endpoint to obtain resource information without receiving all data.
PUT /v2//manifests/ Manifest Put the manifest identified by name and referencewhere referencecan be a tag or digest.
DELETE /v2//manifests/ Manifest Delete the manifest identified by name and reference. Note that a manifest can onlybe deleted by digest.
GET /v2//blobs/ Blob Retrieve the blob from the registry identified by digest. A HEAD request can also be issued to this endpoint to obtain resource information without receiving all data.
DELETE /v2//blobs/ Blob Delete the blob identified by name and digest
POST /v2//blobs/uploads/ Initiate Blob Upload Initiate a resumable blob upload. If successful, an upload location will be provided to complete the upload. Optionally, if the digestparameter is present, the request body will be used to complete the upload in a single request.
GET /v2//blobs/uploads/ Blob Upload Retrieve status of upload identified by uuid. The primary purpose of this endpoint is to resolve the current status of a resumable upload.
PATCH /v2//blobs/uploads/ Blob Upload Upload a chunk of data for the specified upload.
PUT /v2//blobs/uploads/ Blob Upload Complete the upload specified by uuid, optionally appending the body as the final chunk.
DELETE /v2//blobs/uploads/ Blob Upload Cancel outstanding upload processes, releasing associated resources. If this is not called, the unfinished uploads will eventually timeout.
GET /v2/_catalog Catalog Retrieve a sorted, json list of repositories available in the registry.



Registry V2 UI

docker run --name registry-browser -it -p 8080:8080 -e DOCKER_REGISTRY_URL=http://localhost:5000 klausmeyer/docker-registry-browser
相關文章
相關標籤/搜索