2

I'm using Docker version 20.10.21 under Ubuntu server 22.04. Since a week ago, my Docker containers can't reach public APIs on the internet (for example Public holidays in France). They could reach it before an apt update and upgrade was done.

I was thinking that it was a Docker bridge network related issue in a first place, so I tried this solution: My docker container has no internet

Then, I tried

docker network prune

, then I tried to uninstall and reinstall Docker.

After investigations, I was wrong about my diagnosis because I can ping public names, but I can't curl any URL:

ping but not curl

I don't understand why this issue suddenly happened and I'm out of thoughts to solve this.

UPDATE:

Docker containers can't curl any URL, but my Ubuntu host does.

With docker host network, curl is working for the given API.

On the other hand, if I'm running the same container on Docker Desktop, on my dev computer, that works well.

Gambi
  • 464
  • 4
  • 12
  • Is that a valid end point? Does `curl https://calendrier.api.gouv.fr` work? – Riley Martin Nov 04 '22 at 19:30
  • No it doesn't. I can't curl any url, even google.com... But Docker host computer does. – Gambi Nov 04 '22 at 19:32
  • Start with `docker container inspect` to figure out which network the container is using, then use `docker network inspect` and post the network configuration in your question. Also, of course, check your host's firewall settings. – root Nov 06 '22 at 07:26

1 Answers1

2

I finally found out what was the issue. The MTU of my host network interface was different from the default value of the docker network (1500).

I checked my network interface MTU:

ip a | grep mtu

eno1 mtu value

And then, I settled the MTU for the docker daemon in /etc/docker/daemon.json :

{
    "mtu" : 1280
}

Then don't forget to restart docker:

systemctl restart docker
Gambi
  • 464
  • 4
  • 12