How to use a private registry from gitlab

Okay so im still new here but I’ll get to the point. I have a local rancher runing on my system to test for our dev team. We need to use some custom docker images for our application and have it automatically updated to the rancher server. So the question is how Do I get rancher to use our registry that on gitlab?
What I have done so far…
Gone to resources – registries then went to add registries.
added in custom https://registry .gitlab .com with username and password.
Go to workloads, launch.
in images I used name:latest
click okay and wait for 10 mins just for the thing to say that It timed out.
From the events it says that the image can not be pulled.
I also added a registry that is registry. gitlab .com and registry .gitlab. com/my-username/project

Normal Scheduled Successfully assigned neo/test2-7d75fbbd97-ptfpx to bigthink 18 minutes ago
Normal SandboxChanged Pod sandbox changed, it will be killed and re-created. 18 minutes ago
Normal Pulling pulling image “avercastadmin/neo:latest” 17 minutes ago
Warning Failed Failed to pull image “avercastadmin/neo:latest”: rpc error: code = Unknown desc = Error response from daemon: pull access denied for avercastadmin/neo, repository does not exist or may require ‘docker login’ 16 minutes ago
Warning Failed Error: ErrImagePull 16 minutes ago
Normal BackOff Back-off pulling image “avercastadmin/neo:latest” 8 minutes ago
Warning Failed Error: ImagePullBackOff 3 minutes ago

What am I doing wrong?

Found it out… my browser was auto inputting a wrong password for me… So stupid of me…

I had the exact same issue.

I found that I could do this when I create a helm chart for my applications

- name: private-gitlab

Where private-gitlab is the name of the registry you defined in the GUI.

I have however not found the same option on the manual deploy settings on the GUI… so the only way was to ssh into the node and “docker pull” the image.

1 Like

That’s the same thing we’re basically doing. I have a Chef cookbook that I run to setup Docker on the nodes, and in that I have docker pull down the private docker images. Would be great to have a way around this and to be able to do it all from within Rancher.

Today I was also struggling with Deployment from private registry. @guy’s solution worked for me by adding:

    - name: my-registry

I was wondering that it would really be nice to have Rancher GUI field for this! What do you think?


Fully agree this should be in the GUI, after all the GUI already has a provision to set the private registries… just need away to address them.

The UI (API, really) automatically picks a suitable registry credential. When you write Yaml you’re on your own and must specify it.

@vincent, actually you are right - Rancher picks up imagePullSecrets itself, when Deployment is created. In my situation Deployment was already created, when I noticed the need for credentials for private registry. Of course, when I provided created private registry’s credentials, they were not picked automatically :slight_smile:.

I’m pretty sure if you create a deploment via the UI, it automatically pulls all registry credentials which exist at that time, into the YAML.