Adding a custom registry to Rancher 2.0

Hello everyone,

I just installed Rancher 2.0.4 HA. The first thing I tried was adding a custom registry but it failed :’)
I went to the ‘Rancher server’ cluster and then Resources -> Registries -> Add
Name : MyRegistry
Available to all namespaces
Address : custom : registry. .com (without the spaces)
Username + password fields have been entered as needed.

But when I hit save I get the following error message :
Validation failed in API: name InvalidFormat 422: invalid value MyRegistry: a DNS-1123 label must consist of lower case alphanumeric characters or ‘-’, and must start and end with an alphanumeric character (e.g. ‘my-name’, or ‘123-abc’, regex used for validation is ‘a-z0-9?’)

Problem is : the registry address is a valid DNS name.
Just to be sure I even tried to enter ‘’ but I get the same error message.

I’ve also tried to create another cluster but the same problem happens.

The error is for the name field, not the address. Name of most things must be valid DNS labels in k8s, and this one is apparently not makes as such in our API or the UI would sure an error before posting.

Hi Vincent,

Thanks a lot it was just the name, there was a char in upper case :slight_smile:

I know this is an old thread, but I have a question about this. The Rancher 2 UI won’t allow you to create a registry that contains dots like, but Kubernetes will allow you to create one with the same name.

$ kubectl create secret docker-registry --docker-username=username --docker-password="password" --docker-email=""
secret/ created

$ kubectl get secrets
NAME                    TYPE                                  DATA      AGE
default-token-7lrp5   3         1d        1         17s

The registry shows up in the Rancher UI, and I can use it in imagePullSecrets and it works fine.

Why does Rancher not allow it, when Kubernetes does allow it?

1 Like