Why do we need a DNS server? For the back gateway, of course! We need to distribute requests to different Docker containers by domain name. I do not recommend through port number, secondary route origin to distinguish, this is really confusing, also bad memory.

1. Install BIND

Run the command on test-node-1

docker run -d \ --name dns \ --restart=always \ -p 53:53/tcp -p 53:53/udp \ -p 10000:10000/tcp \ -v /data/dns:/data \ Sameersbn/bind: 9.16.1-20200524Copy the code

2, validation,

Wait until the installation is complete. Go to https://172.16.113.9:10000/. See, this address is HTTPS. Because this certificate is invalid, access to higher versions of Google Chrome will be blocked to indicate that your connection is not dedicated. It doesn’t even have a button to continue, just type thisisunsafe on the keyboard.

The default password is root/password. After login,

3. The port is occupied

If the container doesn’t start, don’t panic. Let’s check it out. First check with the command:

 lsof -i -P -n | grep LISTEN
Copy the code

After the command is executed, port 53 is displayed to check whether port 53 is used. The default port is 53. ⚠️Centos8 will probably come with dnsmasq by default, this application will take up port 53, so we will disable it:

Systemctl disable dnsmasq killall dnsmasqCopy the code

Then restart the container.

4. Language modification

After the installation is completed, the default is English, we can change it to Chinese, according to the following figure:

5. Modify the configuration

Click BIND DNS Server in the left menu, then click default zone:

Fill in any in the red box below and check all listed:

Then click Save.

Then click Apply Configuration to make the configuration take effect.

6, summary

The DNS server uses bind. Now we have installed it, and when the application is deployed later, we need to use its domain name resolution capability, and we will configure the domain name later.