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: eth0@if23: <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
.