I have a problem when I pull images from insecure registries(in my case, it is harbor). I receive a connection refused error when I use the command below.
sudo crictl pull 192.168.12.10/calculator/app2:new
Below is the full error message:
DEBU[0000] get image connection
DEBU[0000] connect using endpoint 'unix:///run/containerd/containerd.sock' with '2s' timeout
DEBU[0000] connected successfully using endpoint: unix:///run/containerd/containerd.sock
DEBU[0000] PullImageRequest: &PullImageRequest{Image:&ImageSpec{Image:192.168.12.10/calculator/app2:asdf,Annotations:map[string]string{},},Auth:nil,SandboxConfig:nil,}
DEBU[0000] PullImageResponse: nil
FATA[0000] pulling image: rpc error: code = Unknown desc = failed to pull and unpack image "192.168.12.10/calculator/app2:asdf": failed to resolve reference "192.168.12.10/calculator/app2:asdf": failed to do request: Head https://192.168.12.10/v2/calculator/app2/manifests/asdf: dial tcp 192.168.12.10:443: connect: connection refused
Added configuration to ‘/etc/containerd/config.toml’ like this
[plugins."io.containerd.grpc.v1.cri".registry]
config_path = ""
[plugins."io.containerd.grpc.v1.cri".registry.auths]
[plugins."io.containerd.grpc.v1.cri".registry.configs]
[plugins."io.containerd.grpc.v1.cri".registry.configs."192.168.12.10:80".tls]
insecure_skip_verify = true
[plugins."io.containerd.grpc.v1.cri".registry.configs."192.168.12.10:80".auth]
username = "admin12"
password = "Hada123213"
auth = "YWRtaW4xMjpIYWRhMTIzMjEzCg=="
[plugins."io.containerd.grpc.v1.cri".registry.headers]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."192.168.12.10:80"]
endpoint = ["http://192.168.12.10:80"]
To configure this file, I use the below like on stack overflow and github:
In my search on the web, more than 95 percent of websites said to add the insecure registry to /etc/docker/daemon.json to resolve this problem.
but its about docker not contaierd.
2
Answers
in ‘/etc/containerd/config.toml’ convert all of 192.168.12.10:80 to 192.168.12.10 so that will be working well.
because in your ctr command you refer to
and no refer to port number.
for more details look at this link.
Per https://github.com/containerd/containerd/blob/main/docs/hosts.md
The right way to setup should be (in my example
http://172.31.0.36
is the private insecure registry):where
config.toml
should includeand in
hosts.toml
:Restart the
containerd
service:To confirm it works: