<p>I hope somebody can help me.
I'm trying to pull a private docker image with no success. I already tried some solutions that I found, but without success.</p>
<p>Docker, Gitlab, Gitlab-Runner, Kubernetes all run on the same server</p>
<p>Insecure Registry</p>
<pre><code>$ sudo cat /etc/docker/daemon.json
{ &quot;insecure-registries&quot;:[&quot;10.0.10.20:5555&quot;]}
</code></pre>
<p>Config.json</p>
<pre><code>$ cat .docker/config.json
{
        &quot;auths&quot;: {
                &quot;10.0.10.20:5555&quot;: {
                        &quot;auth&quot;: &quot;NDUwNjkwNDcwODoxMjM0NTZzIQ==&quot;
                },
                &quot;https://index.docker.io/v1/&quot;: {
                        &quot;auth&quot;: &quot;NDUwNjkwNDcwODpGcGZHMXQyMDIyQCE=&quot;
                }
        }
}
</code></pre>
<p>Secret</p>
<pre><code>$ kubectl create secret generic regcred \
    --from-file=.dockerconfigjson=~/.docker/config.json \
    --type=kubernetes.io/dockerconfigjson
</code></pre>
<p>I'm trying to create a Kubernetes pod from a private docker image. However, I get the following error:</p>
<pre><code>Name:         private-reg
Namespace:    default
Priority:     0
Node:         10.0.10.20
Start Time:   Thu, 12 May 2022 12:44:22 -0400
Labels:       &lt;none&gt;
Annotations:  &lt;none&gt;
Status:       Pending
IP:           10.244.0.61
IPs:
  IP:  10.244.0.61
Containers:
  private-reg-container:
    Container ID:
    Image:          10.0.10.20:5555/development/app-image-base:latest
    Image ID:
    Port:           &lt;none&gt;
    Host Port:      &lt;none&gt;
    State:          Waiting
      Reason:       ErrImagePull
    Ready:          False
    Restart Count:  0
    Environment:    &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-stjn4 (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  kube-api-access-stjn4:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       &lt;nil&gt;
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              &lt;none&gt;
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason   Age                    From     Message
  ----     ------   ----                   ----     -------
  Normal   BackOff  2m7s (x465 over 107m)  kubelet  Back-off pulling image &quot;10.0.10.20:5555/development/expedicao-api-image-base:latest&quot;
  Normal   Pulling  17s (x3 over 53s)      kubelet  Pulling image &quot;10.0.10.20:5555/development/expedicao-api-image-base:latest&quot;
  Warning  Failed   17s (x3 over 53s)      kubelet  Failed to pull image &quot;10.0.10.20:5555/development/expedicao-api-image-base:latest&quot;: rpc error: code = Unknown desc = failed to pull and unpack image &quot;10.0.10.20:5555/development/app-image-base:latest&quot;: failed to resolve reference &quot;10.0.10.20:5555/development/app-image-base:latest&quot;: failed to do request: Head &quot;https://10.0.10.20:5555/v2/development/app-image-base/manifests/latest&quot;: http: server gave HTTP response to HTTPS client
  Warning  Failed   17s (x3 over 53s)      kubelet  Error: ErrImagePull
  Normal   BackOff  3s (x2 over 29s)       kubelet  Back-off pulling image &quot;10.0.10.20:5555/development/expedicao-api-image-base:latest&quot;
  Warning  Failed   3s (x2 over 29s)       kubelet  Error: ImagePullBackOff
</code></pre>
<p>When I pull the image directly in docker, no problem occurs even with the secret</p>
<p>Pull image</p>
<pre><code>$ docker login 10.0.10.20:5555
Username: 4506904708
Password:
WARNING! Your password will be stored unencrypted in ~/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
$ docker pull 10.0.10.20:5555/development/app-image-base:latest
latest: Pulling from development/app-image-base
Digest: sha256:1385a8aa2bc7bac1a8d3e92ead66fdf5db3d6625b736d908d1fec61ba59b6bdc
Status: Image is up to date for 10.0.10.20:5555/development/app-image-base:latest
10.0.10.20:5555/development/app-image-base:latest
</code></pre>
<p><strong>Can someone help me?</strong></p>

Jeysson Paiva
<p>First, you need to create a file in /etc/containerd/config.toml</p>
<pre><code># Config file is parsed as version 1 by default.
# To use the long form of plugin names set &quot;version = 2&quot;
[plugins.cri.registry.mirrors]
  [plugins.cri.registry.mirrors.&quot;10.0.10.20:5555&quot;]
    endpoint = [&quot;http://10.0.10.20:5555&quot;]
</code></pre>
<p>Second, restart contained</p>
<pre><code>$ systemctl restart containerd
</code></pre>
