See also documentation about Podman and Docker
How to use a docker regsitry
1# list index catalog
2curl https://registry.k3s.example.com/v2/_catalog | jq
3
4# List tags available regarding an image
5curl https://registry.k3s.example.com/v2/myhaproxy/tags/list
6
7# list index catalog - with user/password
8curl https://registry-admin:<PWD>@registry.k3s.example.com/v2/_catalog | jq
9
10# list index catalog - when you need to specify the CA
11curl -u user:password https://<url>:<port>/v2/_catalog --cacert ca.crt | jq
12
13# list index catalog - for OCP
14curl -u user:password https://<url>:<port>/v2/ocp4/openshift4/tags/list | jq
15
16# Login to registry with podman
17podman login -u registry-admin -p <PWD> registry.k3s.example.com
18
19# Push images in the registry
20skopeo copy "--dest-creds=registry-admin:<PWD>" docker://docker.io/goharbor/harbor-core:v2.6.1 docker://registry.k3s.example.com/goharbor/harbor-core:v2.6.1
Install a Local private docker registry
- Change Docker Daemon config to allow insecure connexion with your ip
1ip a
2sudo vi /etc/docker/daemon.json
1{
2"insecure-registries": ["192.168.1.11:5000"]
3}
1sudo systemctl restart docker
2docker info
Check docker config
1docker info
1.../...
2Registry: https://index.docker.io/v1/
3Labels:
4Experimental: false
5Insecure Registries:
6192.168.1.11:5000
7127.0.0.0/8
8Live Restore Enabled: false
- Create a volume to store images
1docker volume create registry
2docker volume ls
- Run docker registry
1# Launch
2docker run -d -p 5000:5000 --restart=always --name registry -v registry:/var/lib/registry registry:2.7
3
4# Check
5docker ps
6
7CONTAINER ID IMAGE COMMAND CREATED
8STATUS PORTS NAMES
9b842ba9788a1 registry:2.7 "/entrypoint.sh /etcโฆ" 5
10seconds ago Up 4 seconds 0.0.0.0:5000->5000/tcp registry
- Push a images in this registry
1# Retag and push
2docker tag myhaproxy 192.168.1.11:5000/myhaproxy
3docker images
4docker push 192.168.1.11:5000/myhaproxy
- Get catalog and tags from a Registry
1# Check individual
2curl 192.168.1.11:5000/v2/_catalog
3curl 192.168.1.11:5000/v2/myhaproxy/tags/list
4
5# Get a list of all images:tags
6for i in $(curl -sk https://registry.example.com/v2/_catalog | jq -r '.repositories[]');
7do
8 for tag in $(curl -sk https://registry.example.com/v2/${i}/tags/list | jq -r '.tags[]');
9 do echo ${i}/${tag};
10 done;
11done
12
13# Podman/Docker pull
14for i in $(curl -sk https://registry.example.com/v2/_catalog | jq -r '.repositories[]');
15do
16 for tag in $(curl -sk https://registry.example.com/v2/${i}/tags/list | jq -r '.tags[]');
17 do podman pull --tls-verify=false registry.example.com/${i}:${tag};
18 done;
19done
20
21# Test if manifest is valid
22for i in $(curl -sk https://registry.example.com/v2/_catalog | jq -r '.repositories[]');
23do
24 for tag in $(curl -sk https://registry.example.com/v2/${i}/tags/list | jq -r '.tags[]');
25 do curl -sk https://registry.example.com/v2/${i}/manifests/${tag};
26 done;
27done
Comments