Log in and pull from a docker private registry with Rancher Desktop (macOS)
If you are struggling to get Rancher Desktop to pull docker images from a private container registry, this is what worked on my setup.
It turns out that Rancher Desktop on macOS uses Lima under the hood to start a linux VM and basically, you need to authenticate any docker private registry from within the linux VM.
First, you need to access the Lima VM. Rancher Desktop bundles its own lima binaries and paths, so you need to specify a
LIMA_HOME env var.
limactl binary is under Rancher’s resources too (or
brew install lima and use that).
$ export LIMA_HOME="$HOME/Library/Application Support/rancher-desktop/lima" $ /Applications/Rancher\ Desktop.app/Contents/Resources/resources/darwin/lima/bin/limactl shell 0 lima-rancher-desktop$ uname -a Linux lima-rancher-desktop 5.15.32-0-virt #1-Alpine SMP Mon, 28 Mar 2022 13:09:00 +0000 aarch64 Linux
From inside the linux VM, it’s now possible to configure docker login credentials. I use a json key file from gcloud https://cloud.google.com/container-registry/docs/advanced-authentication#json-key
lima-rancher-desktop$ cat account.json | docker login -u _json_key --password-stdin https://gcr.io WARNING! Your password will be stored unencrypted in /home/eskerda.linux/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded lima-rancher-desktop$ nerdctl pull gcr.io/some-gcr-account-1234/private_image ...
If this level of indirection is confusing to you, I want you to know that you are not alone. I did hit this when trying to try out a local helm chart I wrote against something and used rancher as an easy way to get kubectl on macOS. Note to self: there’s no easy way, and it’s not possible to use tools you do not understand. The lack of documentation on this is surprising, and google search sending me here did not help at all. It might just be an impression, but I feel google search keeps getting worse and worse on these kind of queries.
On the positive side, I found out about lima-vm/Lima, which is pretty cool (when forced to use macOS, that is). The following pretty much sums it up
$ uname -a Darwin trouble 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000 arm64 $ lima uname -a Linux lima-default 5.15.0-39-generic #42-Ubuntu SMP Thu Jun 9 23:44:48 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux