Skip to main content

Sonatype Nexus OSS as the Docker Registry | Docker API v2

· One min read

Listing Image Tags

# curl "https://<strong><HOST_NAME></strong>/repository/<strong><REPO_NAME></strong>/v2/<strong><IMAGE_NAME></strong>/tags/list"

{"name":"<strong><IMAGE_NAME></strong>","tags":["1.0.0","1.0.1","1.1.0","1.1.1","1.1.2","1.1.3","1.1.4","1.1.5","1.1.6","1.1.7","1.1.8","1.1.9","1.2.0","1.2.1","1.2.1.1","1.2.1.2"]}

Listing Repositories

# curl "https://<strong><HOST_NAME></strong>/repository/<strong><REPO_NAME></strong>/v2/_catalog"
{
    "repositories": [
        "<strong><IMAGE_NAME1></strong>",
        "<strong><IMAGE_NAME2></strong>",
        ...
        "<strong><IMAGE_NAMEn></strong>"
    ]
}

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

http://172.16.127.171:8081/repository/docker-group/v2/_catalog

http://172.16.127.171:8081/repository/docker-group/v2/permit-api/tags/list

https://registry.cn-hangzhou.aliyuncs.com/v2/q1/u8-server

Customize hosts record on docker and kubernetes

· One min read

Docker:

docker run -it --rm --add-host=host1:172.17.0.2 --add-host=host2:192.168.1.3 busybox

use "--add-host" to add entries to /etc/hosts

Kubernetes:

apiVersion: v1
kind: Pod
metadata:
name: hostaliases-pod
spec:
hostAliases:
- ip: "127.0.0.1"
hostnames:
- "foo.local"
- "bar.local"
- ip: "10.1.2.3"
hostnames:
- "foo.remote"
- "bar.remote"
containers:
- name: cat-hosts
image: busybox
command:
- cat
args:
- "/etc/hosts"

use "spec.hostAliases" to configure hosts entry for pod/deployment

https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/

ClustrMaps