Share & learn

Through Innovative Digital Library

How to set permanent DNS for docker container.

Here we have internal DNS server which has to be integrated with upcoming docker container. could you please suggest how to perform this.
 



Answers

Posted by Alex on February 3rd 2018 21:16 PM

Steps 1: We can manually configure nameserver for container by putting nameservers entries into daemon.json file. if daemon.json file doesn't exist, please create it and append below nameserver entery. Steps 2: restart the docker service to reload the config file. Steps 3: Please execute the docker container.

cat /etc/docker/daemon.json 
{
    
"dns": ["10.0.0.2""8.8.8.8"]
}

systemctl restart docker

docker container run 
-it --name newhost centos /bin/bash
Answer Question

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

  • Minimum 20 character
FBTH

related questions

Most liked questions

Most answered questions

Login
FBTH Refresh
Register
FBTH Refresh
Forgot password
Ask a Question
Minimum 20 character
Minimum 20 character
Reply
Minimum 20 character
FBTH Refresh