Set Custom DNS Server On a Docker Container

Using custom DNS Servers in specific networks or applications configuration is standard and, in some cases, improves performance and security.

DNS

The Docker CLI offers the option to set custom DNS servers and also set DNS options. To add a custom DNS server to a Docker container, we add the –dns tag and the server IP address.

In the example below, I’m configuring the container to use Google DNS servers (8.8.8.8).

docker run -it --dns 8.8.8.8 ubuntu /bin/bash
Published
Categorized as Docker

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.