So, simple:
Why?? please help!
Turned out my shared_vpc is the culprit. When I deploy a VM into a default VPC, the docker container can work normally.
The culprit is C3 machine type. If I use E2, then all work fine. Why???
Docker container can't connect to internet on C3-type instance. But works on E2-type instance.
Hi I get same issue, only with C3 machine type
For me, docker network on mode host working, but bridge not
I may have found the issue the c3 machines by default have a mtu size of 1460 set for their host interface.
Docker by default sets its mtu to 1500:
root@ess-os-7fda8fc:~# ip addr | grep mtu
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc mq state UP group default qlen 1000
3: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
7: vethe49860e@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default
root@ess-os-7fda8fc:~#
When I added
{
"mtu": 1460
}
to /etc/docker/daemon.json
and restarted docker
`sudo systemctl restart docker`
I now have the mtu proper:
root@ess-os-7fda8fc:~# ip addr | grep mtu
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc mq state UP group default qlen 1000
3: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc noqueue state UP group default
7: vethe49860e@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc noqueue master docker0 state UP group default
And apt-get update in the docker now works!!!
Did the trick for me, thank you so much!!