Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mackankowski/be575ec0b81fd8ba3a948d3e84410adc to your computer and use it in GitHub Desktop.
Save mackankowski/be575ec0b81fd8ba3a948d3e84410adc to your computer and use it in GitHub Desktop.
Docker network issues when using Rancher Desktop on Mac with Apple Silicon ARM-based processor (M1 chip)

Docker network issues when using Rancher Desktop on Mac with Apple Silicon ARM-based processor (M1 chip)

When pulling image (e.g. docker run hello-world) or signing to the Docker Hub (docker login) the following error occurs:

Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io.

To fix the issue, change DNS server adress for the linux virtual machine instance: lime-vm

Automatic way (recommended)

Open Terminal app and run:

/bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/mackankowski/be575ec0b81fd8ba3a948d3e84410adc/raw/979b09ab2cc6225ddee1aedaf9e893bb839a715a/script.sh)"

The script file is also available here: script.sh

Manual way

Open the terminal and follow the instructions:

  1. Run the internal lime-vm shell from the Rancher Desktop instance:

LIMA_HOME="$HOME/Library/Application Support/rancher-desktop/lima" "/Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/limactl" shell 0

  1. Set permissions to edit the DNS configuration file:

sudo chown $(whoami) /etc/resolv.conf (or sudo chmod 777 /etc/resolv.conf)

  1. Replace DNS server address with 8.8.8.8:

sudo sed -i 's/nameserver.*/nameserver 8.8.8.8/g' /etc/resolv.conf

  1. Type exit to quit the shell.
#!/usr/bin/env bash
lima="$HOME/Library/Application Support/rancher-desktop/lima"
limactl="/Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/limactl"
LIMA_HOME="$lima" "$limactl" shell 0 sudo chown lima /etc/resolv.conf
LIMA_HOME="$lima" "$limactl" shell 0 sudo sed -i 's/nameserver.*/nameserver 8.8.8.8/g' /etc/resolv.conf
@mackankowski
Copy link
Author

mackankowski commented Mar 21, 2022

An alternative way (recommended) for using Docker on the macOS is Colima:

Guide: https://gist.github.com/mackankowski/7b6b1d861359d31b8a28195432d86d4d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment