I setup docker hub proxy on nexus http mode and I want to change the default image registry in containerd .I have kubernetes cluster version 1.27 up and running.how can I achieve this?
change container image registry in containerd to nexus proxy repository
112 Views Asked by Ali farahzadi AtThere are 2 best solutions below
On
In order to use version 1.27 of Nexus as a proxy registry for Docker Hub in your K8S cluster follow below steps:
Utilizing the standard feature known as image registry mirroring, k8s enables you to set up one registry, such as nexus, to serve as a cache for another registry, like docker hub.
You must first establish an image repository policy and provide an image repository policy resource that the nexus registry should be used as the docker hub mirror.
You can use this command kubectl create object -f with a yaml file to define the policy.
Replace the references to the images in your current deployments or pods with those from the Nexus repository rather than the Docker Hub. Immediately utilize the nexus repository url and image name to change the image field in the container specification.
For effective caching, make sure your Nexus repository is set up as a Docker proxy repository. For more details refer to Sonatype Nexus doc on how to set it up as a Proxy Repository for Docker.**
1.run the nexus on docker using this docker-compose config on a remote server :
2.create docker repository with type proxy in nexus that runs on port 8082:
3.enable Allow anonymous docker pull ( Docker Bearer Token Realm required ).:
4.set https://registry-1.docker.io as proxy
5.add this config to containerd conf file