Building Docker image succeeds on one machine but fails on another with `Could not resolve …`
I build my Docker image with the following command:
docker build -t my-tag:0.0.0 -f Dockerfile-staging .
On my machine (MBP in Thailand) it works.
On my colleagues machine (Ubuntu, China) it errors with:
Step 3/9 : RUN apt-get update && apt-get upgrade -y && apt-get install -y gcc && apt-get install -y git && apt-get install -y libcurl4 && apt-get install -y libpq-dev && apt-get install -y libssl-dev && apt-get install -y python3-dev && apt-get install -y librtmp-dev && apt-get install -y libcurl4-gnutls-dev && apt-get install -y libcurl4-openssl-dev && apt-get install -y postgresql-9.3 && apt-get install -y python-psycopg2
---> Running in f405a317507e
Err:1 http://deb.debian.org/debian buster InRelease
Could not resolve 'debian.map.fastlydns.net' Could not resolve 'deb.debian.org'
Err:2 http://security.debian.org/debian-security buster/updates InRelease
Could not resolve 'debian.map.fastlydns.net' Could not resolve 'security.debian.org'
Err:3 http://deb.debian.org/debian buster-updates InRelease
Could not resolve 'debian.map.fastlydns.net' Could not resolve 'deb.debian.org'
Reading package lists...
W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease Could not resolve 'debian.map.fastlydns.net' Could not resolve 'deb.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease Could not resolve 'debian.map.fastlydns.net' Could not resolve 'security.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease Could not resolve 'debian.map.fastlydns.net' Could not resolve 'deb.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Why is this happening? And how to fix?
Source: Docker Questions