Debugging “Temporary failure in name resolution” in Docker containers

I was encountering DNS issues with Docker containers orchestrated by DDEV earlier. Some hosts failed to resolve only within the container for some reason.

To fix it, I changed the following options in the `/etc/default/docker` file:

DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"

This helps override the DNS options for Docker containers. Afterwards restart the Docker service:

sudo service docker restart

This solved the problem for me. I found the solution on Stackoverflow.