Sometimes Docker’s networking acts funky. I had the following error while using docker-compose with a ruby:2.7.1-alpine3.11 image.

RUN apk add --update --no-cache curl

fetch http://mirror.yandex.ru/mirrors/alpine/v3.5/main/x86_64/APKINDEX.tar.gz
fetch http://mirror.yandex.ru/mirrors/alpine/v3.5/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://mirror.yandex.ru/mirrors/alpine/v3.5/main/x86_64/APKINDEX.tar.gz: temporary error (try again later)
WARNING: Ignoring http://mirror.yandex.ru/mirrors/alpine/v3.5/community/x86_64/APKINDEX.tar.gz: temporary error (try again later)
ERROR: unsatisfiable constraints:

So the reason could be many but some networks will block public DNS servers. This may happen if you’re using Windows 10’s WSL with Ubuntu 18.04 LTS or if a network admin creates a rule. The fix is easy.

Create this file and insert the following contents:

/etc/docker/daemon.json

{
    "dns": ["8.8.8.8"]
}
sudo service docker restart