I have a weird recurring issue. I'm using Docker to run a Ruby container on Mac OS. The Dockerfile is pretty normal:
FROM ruby:2.7.6-slim RUN apt-get update -qq && \ apt-get install -y git libpq-dev libxml2-dev build-essential libcurl4-openssl-dev && \ apt-get install -y curl gnupg apt-transport-https postgresql-client imagemagick file && \ ... irrelevant stuff ...
Shortly after starting the container, my local machine invariably loses its connection to
http://deb.debian.org during the
apt-get install phase. Subsequent attempts to start the container will net the following error:
#5 30.70 W: Failed to fetch http://deb.debian.org/debian/dists/bullseye/InRelease Could not connect to deb.debian.org:80 (22.214.171.124), connection timed out #5 30.70 W: Failed to fetch http://deb.debian.org/debian-security/dists/bullseye-security/InRelease Unable to connect to deb.debian.org:80: #5 30.70 W: Failed to fetch http://deb.debian.org/debian/dists/bullseye-updates/InRelease Unable to connect to deb.debian.org:80:
It's having trouble connecting to
http://deb.debian.org/*. I can verify this by just attempting
$ curl http://deb.debian.org/debian/dists/bullseye/InRelease in either the Docker container, or in my local machine. In both places it just hangs forever. Same if I just try to open that website in a browser.
If I restart my host machine, I regain the ability to connect to
deb.debian.org over HTTP temporarily. At least, until I try to restart the Dockerfile.
It feels like a firewall issue, but I don't think it is a firewall issue. Other computers on my LAN are able to run the container from the same Dockerfile without issue. It seems to be localized to just this computer.
I've tried using a VPN, and using my mobile phone data connection. Both fail similarly, so it must be localized to this machine.
Are there any additional troubleshooting steps I can perform to try and determine where I'm losing the connection? I tried a traceroute, and it made it a few hops before similarly getting stuck.