Docker Community Forums

Share and learn in the Docker community.

Docker unable to connect with network - worked on tumbleweed, on Leap i doesn't


#1

Hello fellow Docker Forum users,
I had an OpenSuse tumbleweed edition, and there I was able to make a standard installation of Docker - using zypper from repo, setting proxy env variables - it worked.

Because of some reasons, I have switched to OpenSuse Leap 15 installed on virtualbox 5.2.22 r126460 machine:

NAME="openSUSE Leap"
VERSION="15.0"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.0"
PRETTY_NAME="openSUSE Leap 15.0"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.0"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"

I have installed docker from official repository, but it was quite outdated - thought that this is an issue, so got new from : https://build.opensuse.org/package/show/home%3Ajanhebler%3Akubi/docker

My proxy settings are in ~/.docker/config.json:

{
 "proxies":
 {
   "default":
   {
     "httpProxy": "http://xx.xx.xx:9x",
     "httpsProxy": "http://xx.xx.xx:9x",
     "noProxy": "localhost"
   }
 }
}

also I have set env variables, so http_proxy, https_proxy , HTTP_PROXY and HTTPS_PROXY are available. Please note that https_proxy = http_proxy, it is not a typo.

wget, maven, browser is working fine. I can also wget a website from error messages. unfortunately, docker has issues with every command.

This si the output from docker run hello-world:

docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).

From docker search opensuse:

Error response from daemon: Get https://index.docker.io/v1/search?q=opensuse&n=25: dial tcp 52.73.11.219:443: i/o timeout

My etc/resolv.conf file looks like this:

### /etc/resolv.conf file autogenerated by netconfig!
#
# Before you change this file manually, consider to define the
# static DNS configuration using the following variables in the
# /etc/sysconfig/network/config file:
#     NETCONFIG_DNS_STATIC_SEARCHLIST
#     NETCONFIG_DNS_STATIC_SERVERS
#     NETCONFIG_DNS_FORWARDER
# or disable DNS configuration updates via netconfig by setting:
#     NETCONFIG_DNS_POLICY=''
#
# See also the netconfig(8) manual page and other documentation.
#
# Note: Manual change of this file disables netconfig too, but
# may get lost when this file contains comments or empty lines
# only, the netconfig settings are same with settings in this
# file and in case of a "netconfig update -f" call.
#
### Please remove (at least) this line when you modify the file!
search xx.xx
nameserver 172.19.x.65
nameserver 172.19.x.64

I’ve tried to delete default settings and provide dns 8.8.8.8, but then even wget is not working.

Could you tell me what might be wrong? I am open for any suggestion, and will provide answer to any question you have.
Best regards, Piotr


#2

New information here:
When I change the network to no-proxy one, docker works fine - searching anr running hello-world.
being still on open-proxy network, I tried to set proxy for docker - so it will fail to execute commands, there is no proxy server on the network.
I was surprised when setting HTTP_PROXY, config.json or environmental variable -e was not making docker to fail. It was still able to search or run hello-world (download it again).
It looks like there is not way to make docker use proxy setting?


#3

This is what solved my issue:

$sudo cp /usr/lib/systemd/system/docker.service /etc/systemd/system/

コピーしたdocker.serviceの[Service]の下、ExecStartコマンドの直前にProxyの設定を下記のように追記します。

$sudo vim /etc/systemd/system/docker.service

docker.service

Environment=“HTTP_PROXY=http://user:pwd@proxy.example.com:8080”

設定を再読込とDockerの再起動をします。

sudo systemctl daemon-reload sudo systemctl restart docker

source:
http://haruka0000.hatenablog.com/entry/2016/11/17/172942