Cannot reach update servers

$ docker run -i ubuntu:latest apt-get update
Ign:1 http://archive.ubuntu.com/ubuntu focal InRelease
Ign:2 http://security.ubuntu.com/ubuntu focal-security InRelease
Err:3 http://security.ubuntu.com/ubuntu focal-security Release
  404  Not Found [IP: 91.189.88.142 80]
Ign:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Ign:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Err:6 http://archive.ubuntu.com/ubuntu focal Release
  404  Not Found [IP: 91.189.88.152 80]
Err:7 http://archive.ubuntu.com/ubuntu focal-updates Release
  404  Not Found [IP: 91.189.88.152 80]
Err:8 http://archive.ubuntu.com/ubuntu focal-backports Release
  404  Not Found [IP: 91.189.88.152 80]
Reading package lists...
E: The repository 'http://security.ubuntu.com/ubuntu focal-security Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu focal Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu focal-updates Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu focal-backports Release' does not have a Release file.
$

This is the same with UFW is disabled.

I can reach them on my desktop running ubuntu in virtualbox, but not from a VPS - this is the result from a different site:

$ docker run ubuntu:latest apt-get update


Err:1 http ://archive.ubuntu .com/ubuntu focal InRelease
  Could not connect to archive.ubuntu .com:80 (91.189.88.152), connection timed out Could not connect to archive.ubuntu .com:80 (91.189.88.142), connection timed out
Err:2 http ://archive.ubuntu .com/ubuntu focal-updates InRelease
  Unable to connect to archive.ubuntu .com:http:
Err:3 http ://archive.ubuntu .com/ubuntu focal-backports InRelease
  Unable to connect to archive.ubuntu .com:http:
Err:4 http:// security.ubuntu .com/ubuntu focal-security InRelease
  Could not connect to security.ubuntu .com:80 (91.189.88.142), connection timed out Could not connect to security.ubuntu .com:80 (91.189.91.39), connection timed out Could not connect to security.ubuntu .com:80 (91.189.88.152), connection timed out Could not connect to security.ubuntu .com:80 (91.189.91.38), connection timed out
Reading package lists...
W: Failed to fetch http ://archive.ubuntu .com/ubuntu/dists/focal/InRelease  Could not connect to archive.ubuntu .com:80 (91.189.88.152), connection timed out Could not connect to archive.ubuntu .com:80 (91.189.88.142), connection timed out
W: Failed to fetch http ://archive.ubuntu .com/ubuntu/dists/focal-updates/InRelease  Unable to connect to archive.ubuntu .com:http:
W: Failed to fetch http ://archive.ubuntu .com/ubuntu/dists/focal-backports/InRelease  Unable to connect to archive.ubuntu .com:http:
W: Failed to fetch http ://security.ubuntu .com/ubuntu/dists/focal-security/InRelease  Could not connect to security.ubuntu .com:80 (91.189.88.142), connection timed out Could not connect to security.ubuntu .com:80 (91.189.91.39), connection timed out Could not connect to security.ubuntu .com:80 (91.189.88.152), connection timed out Could not connect to security.ubuntu .com:80 (91.189.91.38), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.
$

I’ve fixed it by recreating the bridge interface

iptables -t nat -F
ifconfig docker0 down
brctl delbr docker0

Hi Logicfish,

I fixed by changing the source list before calling apt-update.

...
RUN sed -i'' 's/archive.ubuntu.com/us.archive.ubuntu.com/' /etc/apt/sources.list 

RUN apt update && apt install -y \
...