dockerkubernetesranchercontainerdrancher-desktop

How to set proxy credentials for Rancher Desktop


I have installed Rancher Desktop. It is working perfectly except for the inability for nerdctl and k3s to download docker images from hub.docker.com from behind my corporate firewall.

Question 1: After downloading Rancher Desktop, how do I set my corporate proxy credentials such that Kubernetes (with Rancher Desktop) pulls images from hub.docker.com.

Question 2: After downloading Rancher Desktop, how do I set my corporate proxy credentials such that the following command works from behind my corporate firewall.

% nerdctl run --name jerrod-mysql-test -e MYSQL_ROOT_PASSWORD=password -p 7700:3306 mysql:8.0

INFO[0000] trying next host                              error="failed to do request: Head \"https://registry-1.docker.io/v2/library/mysql/manifests/8.0\": dial tcp: lookup registry-1.docker.io on xxx.xxx.x.x:53: no such host" host=registry-1.docker.io
FATA[0000] failed to resolve reference "docker.io/library/mysql:8.0": failed to do request: Head "https://registry-1.docker.io/v2/library/mysql/manifests/8.0": dial tcp: lookup registry-1.docker.io on xxx.xxx.x.x:53: no such host 

Solution

  • I am using mac. In mac. machine, add proxy details to /etc/conf.d/docker file.

    #rdctl shell
    
    #sudo su -
    
    #vi  /etc/conf.d/docker
     
     
    NO_PROXY="localhost,127.0.0.1"
    
    HTTPS_PROXY="http://HOST:PORT"
    
    HTTP_PROXY="http://HOST:PORT"
     
    export HTTP_PROXY
    
    export HTTPS_PROXY
    
    export NO_PROXY