Forum Stats

  • 3,824,999 Users
  • 2,260,452 Discussions
  • 7,896,380 Comments

Discussions

Could not connect to host from docker in oracle cloud

User_G5MYU
User_G5MYU Member Posts: 2 Green Ribbon

This is happening in the latest  debian:sid, whereas the same setting had always been working before. Here is how to duplicate the problem:

docker run -t -i debian:sid
# then from within the debian:sid docker

apt update
apt install iproute2 iputils-ping

$ apt update
Hit:1 http://deb.debian.org/debian sid InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
20 packages can be upgraded. Run 'apt list --upgradable' to see them.

# so far so good, now set my http_proxy:

export http_proxy=http://172.17.0.1:3142/

% apt update
Ign:1 http://deb.debian.org/debian sid InRelease
Ign:1 http://deb.debian.org/debian sid InRelease
Ign:1 http://deb.debian.org/debian sid InRelease
Err:1 http://deb.debian.org/debian sid InRelease
  Could not connect to 172.17.0.1:3142 (172.17.0.1). - connect (113: No route to host)
W: Failed to fetch http://deb.debian.org/debian/dists/sid/InRelease  Could not connect to 172.17.0.1:3142 (172.17.0.1). - connect (113: No route to host)

$ ip a s eth0
22: [email protected]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:ac:11:00:03 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 172.17.0.3/16 brd 172.17.255.255 scope global eth0
       valid_lft forever preferred_lft forever

$ ping 172.17.0.1
PING 172.17.0.1 (172.17.0.1) 56(84) bytes of data.
64 bytes from 172.17.0.1: icmp_seq=1 ttl=64 time=0.042 ms
64 bytes from 172.17.0.1: icmp_seq=2 ttl=64 time=0.055 ms
^C
--- 172.17.0.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1010ms

I.e., things were OK before I set my http_proxy, and broke after that.

When outside the docker, my proxy server works just fine:

export http_proxy=http://172.17.0.1:3142/

$ sudo apt update
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:2 https://download.docker.com/linux/ubuntu focal InRelease                                                                              
Hit:3 http://....clouds.archive.ubuntu.com/ubuntu focal InRelease                                                             
Get:4 ...
Fetched 336 kB in 1s (305 kB/s)    
Reading package lists... Done
Building dependency tree       
Reading state information... Done

The host is oracle Ubuntu, which is what I'm using for the first time:

$ uname -rm
5.11.0-1022-oracle x86_64

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:        20.04
Codename:       focal

$ docker --version
Docker version 20.10.12, build e91ed57

apt policy docker-ce-cli
docker-ce-cli:
  Installed: 5:20.10.12~3-0~ubuntu-focal
  Candidate: 5:20.10.12~3-0~ubuntu-focal
  Version table:
 *** 5:20.10.12~3-0~ubuntu-focal 500
        500 https://download.docker.com/linux/ubuntu focal/test amd64 Packages

UPDATES:

  • I first thought that most probably it is because I'm using the test instead of the stable version of docker, got from test.docker.com. But having replace it with normal docker, the symptom remains exactly the same, as this is the docker I'm currently having in my oracle Ubuntu VM:
$ docker --version
Docker version 20.10.7, build 20.10.7-0ubuntu5~20.04.2

$ apt policy docker.io
docker.io:
  Installed: 20.10.7-0ubuntu5~20.04.2
  Candidate: 20.10.7-0ubuntu5~20.04.2

My current suspect is my oracle Ubuntu VM, as I've tried the same thing in my Azure Ubuntu VM, with everything the same, and it works there.

The only (major) differences between them is the kernel, 5.11.0-1022-oracle vs. 5.4.0-1039-azure.

Answers

  • User_G5MYU
    User_G5MYU Member Posts: 2 Green Ribbon

    This is my network in host:

    $ ip a s
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc pfifo_fast state UP group default qlen 1000
        link/ether 02:00:17:...
        altname enp0s3
        inet 10.0.0.2/24 brd 10.0.0.255 scope global ens3
           valid_lft forever preferred_lft forever
        inet6 fe80::17ff:.../64 scope link 
           valid_lft forever preferred_lft forever
    3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
        link/ether 02:42:...
        inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
           valid_lft forever preferred_lft forever
        inet6 fe80::.../64 scope link 
           valid_lft forever preferred_lft forever