How to Solve Error Message error copying image to the remote destination error loading registries configuration mixing sysregistry v1/v2 is not supported

Posted on

Introduction

This article will focus on how to solve an error message. The error message in general exist as in the title of this article. But the full error message exist in the following output command execution :

[root@10 lib]# podman push localhost:5000/hello-world
Error: error copying image to the remote destination: Error initializing destination docker://localhost:5000/hello-world:latest: error loading registries: error loading registries configuration "/etc/containers/registries.conf": mixing sysregistry v1/v2 is not supported
[root@10 lib]#

Actually, the error will also trigger upon executing any command relate with podman. The following command is actually another form of command using the non-root user. The command exist as in the following command execution :

[admin@10 ~]$ podman run --privileged -d --name registry -p 5000:5000 -v /var/lib/registry:/var/lib/registry --restart=always registry:2
Error: error loading registries configuration "/etc/containers/registries.conf": mixing sysregistry v1/v2 is not supported
[admin@10 ~]$

Basically, everything is just fine until the podman registry configuration has another additional lines. Those lines are for the configuration in the purpose of having a local image registry for any container technology available. In this context, it is for podman. The following is the addition of the configuration line :

[registries.insecure]
registries = ['localhost:5000']

Apparently, it will mess the podman command execution. It will affect podman so every command execution will generate the error above.

 

Solution

Actually, the answer is simple. It is just the configuration of the podman have several mixed syntax pattern. Just reverse back the configuration. Just use the default configuration available. Try to give a comment to the new additional line as follows :

#[registries.insecure]
#registries = ['localhost:5000']

On the other hand, just try to add the new address for the local image registry in the default configuration. The original configuration exist below :

unqualified-search-registries = ["registry.fedoraproject.org", "registry.access.redhat.com", "registry.centos.org", "docker.io"]

Modify it so the look of the new modified configuration exist as follows :

unqualified-search-registries = ["localhost:5000","registry.fedoraproject.org", "registry.access.redhat.com", "registry.centos.org", "docker.io"]

So, instead of creating a new additional configuration line which is considered as the configuration syntax pattern of v1, just add it in the existing v2 configuration syntax pattern. Which one is the v1 and the v2 configuration syntax pattern ?. The original one is the v2 configuration syntax pattern as the default exist above. It is the following configuration syntax pattern :

unqualified-search-registries = ["registry.fedoraproject.org", "registry.access.redhat.com", "registry.centos.org", "docker.io"]

On the other hand, the v1 configuration syntax pattern is the following one :

[registries.insecure]
registries = ['localhost:5000']

So, instead of adding a new v1 configuration syntax pattern, just add the local image repository URL in the existing v2 configuration syntax pattern as in the above modified one. It exist as follows :

unqualified-search-registries = ["localhost:5000","registry.fedoraproject.org", "registry.access.redhat.com", "registry.centos.org", "docker.io"]

Look at the above v2 configuration syntax pattern. Just check the first entry with the value of “localhost:5000”. It is the new addition of the local image repository URL to the v2 configuration syntax pattern.

Leave a Reply