PART-1 : https://medium.com/@elliot004/docker-private-registry-setup-with-http-and-https-bcc241be9393
lets assume that local registry is running on 192.168.99.108:5001
name of the registry is registry-test.
to get the list of tags
$ curl -sSL "http://192.168.99.108:5002/v2/nginx/tags/list" | jq -r '.tags[0]'
latest
get the manifest for latest tag
$ curl -sSL -I -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' -k "http://192.168.99.108:5001/v2/nginx/manifests/latest"
o/p:
Manifest.json
> HTTP/1.1 200 OK
> Content-Length: 1362
> Content-Type: application/vnd.docker.distribution.manifest.v2+json
> Docker-Content-Digest: sha256:0efad4d09a419dc6d574c3c3baacb804a530acd61d5eba72cb1f14e1f5ac0c8f
> Docker-Distribution-Api-Version: registry/2.0
> Etag: "sha256:0efad4d09a419dc6d574c3c3baacb804a530acd61d5eba72cb1f14e1f5ac0c8f"
> X-Content-Type-Options: nosniff
> Date: Fri, 03 Jul 2020 16:48:29 GMT{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"size": 7510,
"digest": "sha256:2622e6cca7ebbb6e310743abce3fc47335393e79171b9d76ba9d4f446ce7b163"
},
"layers": [
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 27098265,
"digest": "sha256:8559a31e96f442f2c7b6da49d6c84705f98a39d8be10b3f5f14821d0ee8417df"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 26212264,
"digest": "sha256:8d69e59170f7dac013ef436408ed9ddc688dd9ad3bc030bd868add55a77e25f8"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 538,
"digest": "sha256:3f9f1ec1d262b2889a5fc19bf295f48346dbd8238e22f3eb3dd8a907ca002372"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 902,
"digest": "sha256:d1f5ff4f210df5d5f6bf48438d33ba0d086c4e08a803acf22292ccd4ede92bd2"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 672,
"digest": "sha256:1e22bfa8652e0db3a316e2c946ea048b60560630d4faa58405da4c5fcdb3ff07"
}
]
}
- the digest of a compressed layer diff is = ‘content digest’ = hashes of the compressed , archived diff contents
follow the https://windsock.io/explaining-docker-image-ids/ for more details
lets get inside the registry-test container
$ docker exec -it registry-test sh
/# cd /var/lib/registry/docker/registry/v2/repositories
/# ls -ltrdrwxr-xr-x 3 root root 4096 Jun 28 15:48 _layers
drwxr-xr-x 2 root root 4096 Jun 28 15:49 _uploads
drwxr-xr-x 4 root root 4096 Jun 28 15:49 _manifests/# tree _layers|_sha256
|_d1f5ff4f210df5d5f6bf48438d33ba0d086c4e08a803acf22292ccd4ede92bd2
|_ link
|_3f9f1ec1d262b2889a5fc19bf295f48346dbd8238e22f3eb3dd8a907ca002372
|_ link
|_1e22bfa8652e0db3a316e2c946ea048b60560630d4faa58405da4c5fcdb3ff07
|_ link
|_8d69e59170f7dac013ef436408ed9ddc688dd9ad3bc030bd868add55a77e25f8
|_ link
|_8559a31e96f442f2c7b6da49d6c84705f98a39d8be10b3f5f14821d0ee8417df
|_ link
|_2622e6cca7ebbb6e310743abce3fc47335393e79171b9d76ba9d4f446ce7b163
|_ link/# tree _manifests|_revisions
|_sha256
|_0efad4d09a419dc6d574c3c3baacb804a530acd61d5eba72cb1f14e1f5ac0c8f
|_link
|_tags
|_latest
|_ current
|_link
|_index
|_sha256
0efad4d09a419dc6d574c3c3baacb804a530acd61d5eba72cb1f14e1f5ac0c8f
link/# tree _uploads
docker image digest
$ docker images --digests | grep -i "192.168.99.100:5001/nginx"
sha256:0efad4d09a419dc6d574c3c3baacb804a530acd61d5eba72cb1f14e1f5ac0c8f
docker registry is pulling docker images based on tags and revision.
tags: folder for each image tags, these are link to images in revisions.
$ docker pull 192.168.99.108:5001/nginx:latest$ docker pull 192.168.99.108:5001/nginx@sha256:0efad4d09a419dc6d574c3c3baacb804a530acd61d5eba72cb1f14e1f5ac0c8f
both are equivalent, latest tag and hash , both will pull the docker images
to delete the image from
$ curl -v -sSL -X DELETE 'http://192.168.99.108:5001/v2/nginx/manifests/sha256:0efad4d09a419dc6d574c3c3baacb804a530acd61d5eba72cb1f14e1f5ac0c8f'* Uses proxy env variable no_proxy == 'localhost,127.0.0.1,192.168.99.100,192.168.99.108,192.168.99.*'
* Trying 192.168.99.108...
* TCP_NODELAY set
* Connected to 192.168.99.108 (192.168.99.108) port 5001 (#0)
> DELETE /v2/nginx/manifests/sha256:0efad4d09a419dc6d574c3c3baacb804a530acd61d5eba72cb1f14e1f5ac0c8f HTTP/1.1
> Host: 192.168.99.108:5001
> User-Agent: curl/7.61.1
> Accept: */*
>
< HTTP/1.1 202 Accepted
< Docker-Distribution-Api-Version: registry/2.0
< X-Content-Type-Options: nosniff
< Date: Fri, 03 Jul 2020 17:40:32 GMT
< Content-Length: 0
< Content-Type: text/plain; charset=utf-8
<
* Connection #0 to host 192.168.99.108 left intact
to verify the image has been deleted:
$ docker pull 192.168.99.108:5001/nginxUsing default tag: latest
Error response from daemon: manifest for 192.168.99.108:5001/nginx:latest not found: manifest unknown: manifest unknown
that’s all folks , take it easy !!