imagekubernetesregistrycontainerd

change container image registry in containerd to nexus proxy repository


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?


Solution

  • 1.run the nexus on docker using this docker-compose config on a remote server :

    version: "3.7"
    services:
      nexus:
        image: sonatype/nexus3
        expose:
          - 8081
          - 8082
          - 8083
        ports:
          - "8082:8082"
          - "8083:8083"
          - "8081:8081"
        volumes:
          - nexus:/nexus-data
        restart: always
    volumes:
      nexus: 
    

    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

    version = 2
    enabled_plugins = ["cri"]
    [plugins."io.containerd.grpc.v1.cri".registry]
      [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
        [plugins."io.containerd.grpc.v1.cri".registry.mirrors."95.217.127.212:8082"]
          endpoint = ["http://95.217.127.212:8082"]
      [plugins."io.containerd.grpc.v1.cri".registry.configs]
        [plugins."io.containerd.grpc.v1.cri".registry.configs."95.217.127.212:8082".tls]
          insecure_skip_verify = true