DNS of docker

Fenghua Shenshi 2021-04-08 10:36:55
dns docker


Set up Docker DNS Methods

Docker Container of DNS There are the following ways to set up , And the priority goes from high to low :

1)dockerd Built in DNS Address :127.0.0.11

2) adopt --dns=<ip> Set up for the container DNS Address

docker run --dns=<ip> ......

3)dockerd Set up

That is, documents /etc/docker/daemon.json Settings in :

{
"dns": [
"8.8.8.8",
"1.1.1.1"
]
// The other parts are omitted 
}

notes :dockerd The same thing can be done with the startup parameters of , But this way and modification daemon.json Can't coexist , Specifying startup parameters and modifying the configuration file at the same time will make dockerd Boot failure .

4) The host machine DNS Address

That is to say ( The host machine ) file /etc/resolv.conf Settings in .

dockerd built-in DNS Characteristics

If the network the container uses is a user created bridge ( namely : The network is the bridge , But it's not Docker The one created by default during installation bridge), be dockerd Built in DNS Will record the container name and the container inside the bridge segment IP Correspondence of .

It is inferred from this characteristic that : User created bridges , Containers that use this bridge can visit each other through container names .

Check with the following operation :

Create a bridge

docker network create --driver=bridge my_net

Create a nginx Container and use the bridge

docker run --name=nginx-svc -d --net=my_net nginx:1.19.9

Create another container and use the bridge

docker run --name=my-app -d --net=my_net abcabc:1.0

If it can be executed in this container ping or curl, You can use the

ping nginx-svc
# perhaps 
curl http://nginx-svc

To verify that they are connected .

版权声明
本文为[Fenghua Shenshi]所创,转载请带上原文链接,感谢
https://javamana.com/2021/04/20210408102418085x.html

  1. Hand in hand teaching you to read and debug large open source project zookeeper
  2. 基于SpringBoot 在线答题系统 含小程序!
  3. 10个优秀开源JavaScript模板引擎
  4. JavaScript基础知识及写法
  5. Based on springboot online answering system, including small procedures!
  6. 重磅!谷歌Fuchsia操作系统将支持运行Linux应用程序
  7. (四十) springcloud分布式商城之跟我学习SpringCloud-Gateway整合Eureka路由转发
  8. Spring IOC 特性有哪些,不会读不懂源码!
  9. 手摸手教你阅读和调试大型开源项目 ZooKeeper
  10. 10 excellent open source JavaScript template engines
  11. Basic knowledge and writing method of JavaScript
  12. win10安装mysql5.7
  13. Heavy weight! Google's Fuchsia operating system will support running Linux applications
  14. (40) Spring cloud distributed mall learn from me spring cloud gateway integrates Eureka routing and forwarding
  15. What are the spring IOC features? I can't understand the source code!
  16. Hand in hand teaching you to read and debug large open source project zookeeper
  17. Install mysql5.7 in win10
  18. SCIP:构造数据抽象--数据结构中队列与树的解释
  19. Spring Cloud+Nacos实现服务注册中心(Hoxton版本)
  20. rabbitmq-server的安装与升级
  21. SCIP: constructing data abstraction -- Explanation of queue and tree in data structure
  22. Spring cloud + Nacos to implement service registry (Hoxton version)
  23. Installation and upgrade of rabbitmq server
  24. Lei Jun: Xiaomi's spring conference has been largely streamlined, which will take at least four hours. Some products will be directly released on Weibo
  25. IntelliJ IDEA 2021最新激活码(亲测有效,可激活至 2089 年)
  26. java版本spring cloud+spring boot+mybatis 分布式商城 微服务商城 多租户商城 电子商务 直播带货商城 社交电商
  27. win10安装Redis5.0
  28. (十五)springboot电子商务商城之SpringCloud-使用Eureka集群搭建实现高可用服务注册中心
  29. (十四)springboot电子商务商城之SpringCloud-Eureka自我保护模式和InstanceID的配置
  30. 花生壳内网穿透(Linux版)
  31. Docker部署elasticsearch(单机)
  32. (十三)springboot电子商务商城之SpringCloud-使用Eureka集群搭建实现高可用服务注册中心
  33. (十二)springboot电子商务商城之Eureka注册中心开启密码认证
  34. 七、Spring Boot 集成 Thymeleaf 模板引擎
  35. mysql 命令行秒复制数据库
  36. Windows安装Mysql(msi 图形安装)
  37. The latest activation code of IntelliJ idea 2021
  38. Java应用全链路启动速度提升至15s,阿里云SAE能力再升级
  39. Linux基础命令
  40. Who moved your red envelope? Risk control report of 2021 spring festival activities
  41. Java version spring cloud + spring boot + mybatis distributed mall micro Service Mall multi tenant mall e-commerce live delivery mall social E-commerce
  42. Java 任意音频转MP3
  43. Docker 的 DNS
  44. Docker-搭建日志监控系统
  45. ssm+mysql+maven+shiro进销存系统wms
  46. Installing redis5.0 on win10
  47. (15) Springcloud of springboot E-commerce mall - using Eureka cluster to build and implement high availability service registry
  48. (14) Springcloud Eureka self protection mode and instanceid configuration of springboot E-commerce mall
  49. Peanut shell intranet penetration (Linux version)
  50. Deploying elastic search with docker (stand alone)
  51. (13) Springcloud of springboot E-commerce mall - using Eureka cluster to build and implement high availability service registry
  52. (12) Eureka registry of springboot E-commerce mall opens password authentication
  53. 爱上 Java 的10 大理由!
  54. 7、 Spring boot integrates thymeleaf template engine
  55. 【DB宝41】监控利器PMM的使用--监控MySQL、PG、MongoDB、ProxySQL等
  56. 【DB宝42】MySQL高可用架构MHA+ProxySQL实现读写分离和负载均衡
  57. MySQL command line second replication database
  58. Windows installation of MySQL (MSI graphic installation)
  59. The full link startup speed of Java applications has been increased to 15s, and the SAE capability of alicloud has been upgraded again
  60. Linux basic command