Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Troubleshooting Docker

You're reading from   Troubleshooting Docker Develop, test, automate, and deploy production-ready Docker containers

Arrow left icon
Product type Paperback
Published in Mar 2017
Publisher Packt
ISBN-13 9781783552344
Length 290 pages
Edition 1st Edition
Tools
Arrow right icon
Authors (4):
Arrow left icon
John Wooten John Wooten
Author Profile Icon John Wooten
John Wooten
Navid Ahmed Shaikh Navid Ahmed Shaikh
Author Profile Icon Navid Ahmed Shaikh
Navid Ahmed Shaikh
Vaibhav Kohli Vaibhav Kohli
Author Profile Icon Vaibhav Kohli
Vaibhav Kohli
Rajdeep Dua Rajdeep Dua
Author Profile Icon Rajdeep Dua
Rajdeep Dua
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Understanding Container Scenarios and an Overview of Docker FREE CHAPTER 2. Docker Installation 3. Building Base and Layered Images 4. Devising Microservices and N-Tier Applications 5. Moving Around Containerized Applications 6. Making Containers Work 7. Managing the Networking Stack of a Docker Container 8. Managing Docker Containers with Kubernetes 9. Hooking Volume Baggage 10. Docker Deployment in a Public Cloud - AWS and Azure

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...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime