<registry>/<repository>:<tag>
<repository>
describes purpose<tag>
describes variant or version<repository>:<tag>
is called an image<repository>:<tag>
alpine:stable
nicholasdille/insulatr
sha256:...
–
Upload image to local registry:
docker run -d -p 5000:5000 registry:2
docker build --tag localhost:5000/hello-world-java .
docker push localhost:5000/hello-world-java
docker history hello-world-java
–
Download image manifest:
curl \
-sL \
-H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
http://localhost:5000/v2/hello-world-java/manifests/latest \
| jq
–
Download image configuration:
curl \
-sL \
-H "Accept: application/vnd.docker.container.image.v1+json" \
http://localhost:5000/v2/hello-world-java/manifests/latest \
| jq
–
DIGEST=$(
curl \
-sL \
-H "Accept: application/vnd.docker.container.image.v1+json" \
http://localhost:5000/v2/hello-world-java/manifests/latest \
| jq --raw-output '.layers[-1].digest'
)
curl \
-sL \
-H "Accept: application/vnd.docker.image.rootfs.diff.tar.gzip" \
http://localhost:5000/v2/hello-world-java/blobs/${DIGEST} \
| tar -tvz
–
DIGEST=$(
curl \
-sL \
-H "Accept: application/vnd.docker.container.image.v1+json" \
http://localhost:5000/v2/hello-world-java/manifests/latest \
| jq --raw-output '.layers[-1].digest'
)
curl \
-sL \
-H "Accept: application/vnd.docker.image.rootfs.diff.tar.gzip" \
http://localhost:5000/v2/hello-world-java/blobs/${DIGEST} \
| sha256sum
–
DIGEST=$(
curl \
-sL \
-H "Accept: application/vnd.docker.container.image.v1+json" \
http://localhost:5000/v2/hello-world-java/manifests/latest \
| jq --raw-output '.layers[-1].digest'
)
curl \
-sL \
-H "Accept: application/vnd.docker.image.rootfs.diff.tar.gzip" \
http://localhost:5000/v2/hello-world-java/blobs/${DIGEST} \
| wc -c
127.0.0.1/8
–
# Download manifest from old name
MANIFEST=$(curl -sL \
-H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
localhost:5000/v2/hello-world-java/manifests/latest
)
# Push manifest with new name
curl -X PUT \
-H "Content-Type: application/vnd.docker.distribution.manifest.v2+json" \
-d "${MANIFEST}" \
localhost:5000/v2/hello-world-java/manifests/new
# Test
docker pull localhost:5000/v2/hello-world-java/manifests/new