docker部署coredns
2024-10-07 15:56:10
示例:
[root@corends coredns]# cd /home/coredns/
[root@corends coredns]# ls -al
total
drwxr-xr-x root root Sep : .
drwxr-xr-x. root root Sep : ..
-rwxr-xr-x root root Sep : Corefile
-rwxr-xr-x root root Sep : hosts
-rw-r--r-- root root Sep : install-coredns.sh
[root@corends coredns]# cat install-coredns.sh
#!/bin/bash docker run -d \
--restart always \
--name coredns \
-p :/tcp \
-p :/udp \
-v /home/coredns/hosts:/etc/hosts \
-v /home/coredns/Corefile:/Corefile \
coredns/coredns
[root@corends coredns]# cat Corefile
.: {
hosts {
fallthrough
}
forward . 202.96.128.86 114.114.114.114 8.8.8.8
errors
cache
}
[root@corends coredns]# cat hosts
# 根据实际需要修改
192.168.0.200 devgz.yaohjk.com
192.168.0.200 devboss.yaohjk.com
192.168.0.200 devlogin.yaohjk.com
192.168.0.200 devpay.yaohjk.com
192.168.0.200 devwx.yaohjk.com 192.168.0.200 gz.yaohuiw.net
192.168.0.200 boss.yaohuiw.net
192.168.0.200 login.yaohuiw.net
192.168.0.200 pay.yaohuiw.net
192.168.0.200 wx.yaohuiw.net 192.168.0.199 gz.yaohjk.com
192.168.0.199 boss.yaohjk.com
192.168.0.199 login.yaohjk.com
192.168.0.199 pay.yaohjk.com
192.168.0.199 wx.yaohjk.com 192.168.0.198 boss.yaohuiw.xyz
192.168.0.198 gz.yaohuiw.xyz
192.168.0.198 login.yaohuiw.xyz
192.168.0.198 pay.yaohuiw.xyz
192.168.0.198 wx.yaohuiw.xyz
[root@corends coredns]#
验证:
[root@test2 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.0.246 [root@test2 ~]# nslookup devgz.yaohjk.com
Server: 192.168.0.246
Address: 192.168.0.246# Name: devgz.yaohjk.com
Address: 192.168.0.200
** server can't find devgz.yaohjk.com: NXDOMAIN [root@test2 ~]# nslookup gz.yaohjk.com
Server: 192.168.0.246
Address: 192.168.0.246# Name: gz.yaohjk.com
Address: 192.168.0.199
最新文章
- Cocos2d-x 3.X手游开发实例详解
- hdu 4941 Magical Forest
- PHP 图片文件上传代码分享
- C# 判断某程序是否运行
- poj2608---几个字母映射到同一个数字
- asp.net web api KnownTypeAttribute
- [bzoj1070][SCOI2007]修车——费用流
- eval &; exec(绕过长度限制思路学习)
- IntelliJ IDEA 热部署插件 JRebel 安装激活及使用
- bootstrap-paginator分页插件的两种使用方式
- PHPstorm快捷键Ctrl + Alt + Left 或Right不起作用
- python学习笔记(3)
- 《精通CSS层叠样式表》
- [Maven] guide: maven in 5 minutes
- CentOS7下-bash: nano: command not found
- VS2012 创建的entityframework 4.1版本
- 第八周PSP(11.5--11.9)
- Python 列表表达式 ,迭代器(2) Yield
- CSS之换行
- java基础06 switch
热门文章
- LeetCode--Longest Consecutive Sequence(最长连续序列) Python
- windows 安装 jenkins笔记
- proxy汇总-1
- Android---OS
- NFA 、DFA 简述
- Hibernate Session 4种对象状态
- C#将数据导入到Excel表格中
- 【Shiro】二、Apache Shiro配置
- What size do you use for varchar(MAX) in your parameter declaration?
- 94、tensorflow实现语音识别0,1,2,3,4,5,6,7,8,9