Docker - Error: Docker build “Could not resolve"

How to fix the error:

Err:1 stretch InRelease
Temporary failure resolving ''

which is caused by ruining Docker build.
Add a DNS server to this file. You can also use the Cloudflare DNS ( or Google DNS (

vim /etc/docker/daemon.json
    "dns": ["", ""]

Restart now the Docker service:

sudo service docker restart

Now, you can run your command again.