lookup registry-1.docker.io: no such host

后端 未结 7 619
旧巷少年郎
旧巷少年郎 2020-12-06 10:10

I have docker daemon running on my Ubuntu 16.4 server

my server details:

No LSB modules are available. Distributor ID: Ubuntu Description:

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-06 10:27

    You need to set the proxy for Docker daemon also using environment variable. Docker run is also doing docker pull since the image doesn't exists. In your case the proxy is only applied to the docker run command, which delegates to the docker daemon which is running without proxy.

    Create a file named /etc/systemd/system/docker.service.d/10_docker_proxy.conf with below content

    [Service]
    Environment=HTTP_PROXY=http://1.1.1.1:111
    Environment=HTTPS_PROXY=http://1.1.1.1:111
    

    Make sure to update the proxy as per the ones you have 1.1.1.1:111 is just an example

    Then execute below commands to restart docker

    sudo systemctl daemon-reload
    sudo systemctl restart docker
    

    Now use your docker run command and it should work

提交回复
热议问题