Docker Container could not access the Internet when VPN back Office

When VPN back Office, the Docker Container could not access the Internet.
 
The reason was: https://stackoverflow.com/a/63275062
By default docker-compose sets up a dedicated docker network for each project i.e. a virtual bridge device on the docker host.

To assign a subnet range and gateway address to the network docker tries to select a range from a pool of possible ranges. It checks that the selected range does not overlap with a range/route already bound to a connected network device to prevent issues with colliding address ranges in use by the host.

The VPN on the other hand may add its own routes in order to redirect all traffic through the VPN tunnel. Because of this docker will not be able to find a "unused" address range to assign to the new network.

For more on this see the answers to this question and the respective issue on GitHub

 
1.
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.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.88.142), 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.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.88.142), 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.


2.
$ nmcli dev show | grep 'IP4.DNS'
IP4.DNS[1]: 192.168.1.1

 
3. Even edited /etc/docker/daemon.json, not work.
{
   "dns": ["1.1.1.1", "8.8.8.8"],
   "data-root":"/media/datastore01/docker"
}
 
 
4. Disconnected the VPN. Back to normal, then.



Update