Overview
At a prior job I used Artifactory to manage images. The nice thing about Artifactory is you can create a Virtual Repository in that you configure it to automatically pull images from a Remote Repository to make it available as if it was a Local Repository.
What Docker Distribution is is a simple Docker Repository. Since I’m on High Speed Wi-Fi here in the mountains, I don’t want to keep pulling images and disrupting both our bandwidth but neighbors bandwidth as it’s WiFi.
Installation
Installing the software is easy enough.
# yum install -y docker-distribution
Once installed, check the /etc/docker-distribution/registry/config.yml file for settings but for me, the default is fine. When finished, enable and start the tool.
# systemctl enable docker-distribution
# systemctl start docker-distribution
Listing
I wanted to be able to view what was in the repository and there wasn’t an easy to do it without going into the /var/lib/registry/docker/registry/v2/repositories and parsing out the _manifests and tags directories. As a result, I created an index.php script that parses it out and displays it. In order to do so, I installed the web server and php.
Docker Images
Docker Image Docker Tag Pull String
argocd v2.6.6 bldr0cuomrepo1.dev.internal.pri:5000/argocd:v2.6.6
centos latest bldr0cuomrepo1.dev.internal.pri:5000/centos:latest
cni v3.17.1 bldr0cuomrepo1.dev.internal.pri:5000/cni:v3.17.1
cni v3.18.2 bldr0cuomrepo1.dev.internal.pri:5000/cni:v3.18.2
cni v3.20.1 bldr0cuomrepo1.dev.internal.pri:5000/cni:v3.20.1
coredns 1.3.1 bldr0cuomrepo1.dev.internal.pri:5000/coredns:1.3.1
Managing Images
The steps involved in managing local images is pretty easy over all. I have a separate docker server I use for building images. Over there I pull the image, tag it, and push the image to the local repository.
docker pull registry.k8s.io/kube-apiserver:v1.25.7
docker tag registry.k8s.ip/kube-apiserver:v1.25.7 bldr0cuomrepo1.dev.internal.pri:5000/kube-apiserver:v1.25.7
docker push bldr0cuomrepo1.dev.internal.pri:5000/kube-apiserver:v1.25.7
Once all the images are uploaded, you can then delete any images on the docker server to keep things cleaned up.
docker rmi registry.k8s.io/kube-apiserver:v1.25.7
docker rmi bldr0cuomrepo1.dev.internal.pri:5000/kube-apiserver:v1.25.7
Finally you’ll update the Kubernetes manifests and anything else that loads images from the internet.
Pingback: Kubernetes Index | Motorcycle Touring