Book Image

Troubleshooting Docker

By : Vaibhav Kohli, Rajdeep Dua, John Wooten
Book Image

Troubleshooting Docker

By: Vaibhav Kohli, Rajdeep Dua, John Wooten

Overview of this book

You?re pro Docker? You?ve read all about orchestration with Docker in books? Now learn how to troubleshoot Docker in practice. Gain all the tools to safely see Docker in action with this 2017 book.
Table of Contents (17 chapters)
Troubleshooting Docker
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Free Chapter
1
Understanding Container Scenarios and an Overview of Docker

Configuring DNS


Docker provides hostname and DNS configuration for each container without building a custom image. It overlays the /etc files inside the container with virtual files where it can write new information.

This can be seen by running the mount command inside the container. Containers receive the same /resolv.conf as of the host machine when they are created initially. If a host's /resolv.conf file is modified, it will be reflected in the container's /resolv.conf file only when the container is restarted.

In Docker, you can set the dns options in two ways:

  • Using docker run --dns=<ip-address>

  • In the Docker daemon file, add DOCKER_OPTS="--dns ip-address"

Tip

You can also specify the search domain using --dns-search=<DOMAIN>.

The following diagram shows the nameserver being configured in container using the DOCKER_OPTS setting in the Docker daemon file:

DOCKER_OPTS being used to set nameserver setting for Docker container

The main DNS files are as follows:

/etc/hostname
/etc...