docker官方文档中的dns,link,expose,publish

link是过时的了,尽量不要用。

dns内部集成,也可以用外部。

expose只是用于记录,并不真的。

publish是否起作用,也要看情况,是否被占用端口。

--------------------------------------

 

Embedded DNS server

Docker daemon runs an embedded DNS server which provides DNS resolution among containers connected to the same user-defined network, so that these containers can resolve container names to IP addresses. If the embedded DNS server is unable to resolve the request, it will be forwarded to any external DNS servers configured for the container. To facilitate this when the container is created, only the embedded DNS server reachable at 127.0.0.11 will be listed in the container’s resolv.conf file. For more information on embedded DNS server on user-defined networks, see embedded DNS server in user-defined networks

Exposing and publishing ports

In Docker networking, there are two different mechanisms that directly involve network ports: exposing and publishing ports. This applies to the default bridge network and user-defined bridge networks.

  • You expose ports using the EXPOSE keyword in the Dockerfile or the --expose flag to docker run. Exposing ports is a way of documenting which ports are used, but does not actually map or open any ports. Exposing ports is optional.
  • You publish ports using the PUBLISH keyword in the Dockerfile or the --publish flag to docker run. This tells Docker which ports to open on the container’s network interface. When a port is published, it is mapped to an available high-order port (higher than 30000) on the host machine, unless you specify the port to map to on the host machine at runtime. You cannot specify the port to map to on the host machine in the Dockerfile, because there is no way to guarantee that the port will be available on the host machine where you run the image.

    This example publishes port 80 in the container to a random high port (in this case, 32768) on the host machine.

    $ docker run -it -p 80 nginx$ docker ps64879472feea        nginx               "nginx -g 'daemon ..."   43 hours ago        Up About a minute   443/tcp, 0.0.0.0:32768->80/tcp   blissful_mclean

    The next example specifies that port 80 should be mapped to port 8080 on the host machine. It will fail if port 8080 is not available.

    $ docker run -it -p 80:8080 nginx$ docker psb9788c7adca3        nginx               "nginx -g 'daemon ..."   43 hours ago        Up 3 seconds        80/tcp, 443/tcp, 0.0.0.0:80->8080/tcp   goofy_brahmagupta
    

Before Docker included user-defined networks, you could use the Docker --link feature to allow a container to resolve another container’s name to an IP address, and also give it access to the linked container’s environment variables. Where possible, you should avoid using the legacy --link flag.

When you create links, they behave differently when you use the default bridge network or when you use user-defined bridge networks. For more information, see Legacy Links for link feature in default bridge network and the linking containers in user-defined networks for links functionality in user-defined networks.

转载于:https://www.cnblogs.com/aguncn/p/6880525.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/269354.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

针对“零时差”*** 赛门铁克推免费杀毒软件

针对“零时差”*** 赛门铁克推免费杀毒软件 【eNet硅谷动力消息】据外电报道,从下个月开始,赛门铁克Norton用户将得到一款新的杀毒工具,该工具可以使他们避免遭受“零时差(zero-day)”***。 据悉,这款被称为…

删除git库中untracked files(未监控)的文件

在编译git库拉下来的代码时,往往会产生一些中间文件,这些文件我们根本不需要,尤其是在成产环节做预编译,检查代码提交是否能编译通过这种case时,我们往往需要编译完成后不管正确与否,还原现场,以…

mysql服务器没有及时响应,win10系统Mysql5.7服务启动报:1053错误:服务没有及时响应启动或控制请求...

SharePoint 2013 create workflow by SharePoint Designer 2013这篇文章主要基于上一篇http://www.cnblogs.com/qindy/p/6242714.html的基础上,create a sample workflow by SharePoint De ...thinkphp设置session有效时间thinkphp的框架文件 ThinkPHP/Common/functions.php fu…

为什么牛在天上飞,因为奇虎在地上吹

恶意软件采用各种Hook技术保护自己的文件,过滤或者拦截其他文件的操作,并在关机时自动进行注册以保证恢复。奇虎360安全卫士“破冰(Kill Defence)”技术能将恶意软件的这些操作全部撤销,让系统变得很干净,再…

ajax 小木虫,NIST数据库中Acc. 是什么 小木虫

满意答案ljjqrxrn2017.01.09采纳率:47% 等级:8已帮助:163人在线的好像查起来不方便还有有没有这本书:NIST-JANAF Thermochemical Tables, 4th EditionM. Chase Monograph No. 9: 1998, 1952 pages, 2 volumes, hardcover, ISBN…

【PHP】文件写入和读取详解

文章提纲:一.实现文件读取和写入的基本思路二.使用fopen方法打开文件三.文件读取和文件写入操作四.使用fclose方法关闭文件五.文件指针的移动六.Windows和UNIX下的回车和换行一.实现…

从此博客改变自己

第一篇文章,是写给自己的。大学四年,虽然学的是计算机,但由于自己荒废了最好的学习时光,到现在也只是一只菜鸟而已。走入社会后,激烈的竞争一层层的将自己淘汰下去。父母的日益老去,同时也伴随着不可预知的…

铂金9200系列 服务器,Intel 56核心至强铂金9200终于开卖:单机架1.5万个框框

去年4月初,Intel发布了代号Cascade Lake的第二代至强可扩展处理器,工艺和架构仍然是14nm Skylake-SP,但为了应对核心数量越来越多的AMD霄龙,打造了双芯封装的顶级铂金9200系列,最多56核心112线程。Intel现有架构单芯片…

poi实现Excel导入导出依赖

<!--文件上传组件--><dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId><version>1.3.1</version></dependency><dependency><groupId>commons-io</groupI…

Java中List Set Map 是否有序等总结

1.Collection List Set Map 区别记忆 这些都代表了Java中的集合&#xff0c;这里主要从其元素是否有序&#xff0c;是否可重复来进行区别记忆&#xff0c;以便恰当地使用&#xff0c;当然还存在同步方面的差异&#xff0c;见上一篇相关文章。 有序否 允许元素重复否 Collecti…

Microsoft CRM 3.0 Mobile安装手记(二)——Server端安装

Microsoft CRM 3.0 Mobile分两部分安装&#xff1a;Server端和Mobile端。 Server端安装比较简单。第一步先将.NET Framework 2.0装上&#xff0c;然后去IIS里面检查一下&#xff0c;保证Microsoft CRM 3.0站点以及之下的MSCRMServices目录的ASP .NET版本还是保留1.1的版本。确认…

萌宠大作战服务器维护,萌宠大作战开服表

小时候最简单的快乐现在是否渐行渐远&#xff1f;如果能够在夏日蝉鸣的午后&#xff0c;回到那个快乐又简单的游戏童年&#xff0c;你愿意吗&#xff1f;还好&#xff0c;一款GBA高清像素重置类口袋游戏《萌宠大作战》就能治愈我们&#xff01;带你出走半生&#xff0c;归来仍是…

02ython基础知识(一)

Python基础知识&#xff08;一&#xff09; 变量 namemonkeyfx 变量定义的规则&#xff1a; 变量名只能是 字母、数字或下划线的任意组合变量名的第一个字符不能是数字以下关键字不能声明为变量名: [and, as, assert, break, class, continue, def, del, elif, else, except, e…

用DataTable.Merge()解决了一个排序问题

首先明确一点&#xff0c;DataTable不支持排序。在一个DataTable(dt)中已经存在无序数据&#xff0c;要实现排序&#xff0c;我想到了两个方法&#xff1a; 方法一&#xff1a;可以先构造一个列表(list),按排序顺序存储dt主键列的值; 然后主要是利用DataTable.Merge方法 1 Stro…

x299服务器芯片组,18核心炸裂!X299主板全集:为它真拼了

慵懒了多年的Intel终于彻底爆发了&#xff0c;一出手就让人震颤&#xff0c;直接把桌面平台从10核心推到了18核心(36线程)&#xff0c;同时带来了新的家接口LGA2066&#xff0c;新的芯片组X299。这无疑是各家主板厂商的新机会&#xff0c;台北电脑展上X299主板就如同雨后春笋一…

常用口语

1. I see&#xff0e; 我明白了。2. I quit! 我不干了!3. Let go! 放手!4. Me too&#xff0e; 我也是。5. My god! 天哪!6. No way! 不行!7. Come on&#xff0e; 来吧(赶快)8. Hold on&#xff0e; 等一等。9. I agree。 我同意。10. Not bad&#xff0e; 还不错。11. Not ye…