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
EXPOSEkeyword in the Dockerfile or the--exposeflag todocker 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
PUBLISHkeyword in the Dockerfile or the--publishflag todocker 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 than30000) 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 ps 64879472feea nginx "nginx -g 'daemon ..." 43 hours ago Up About a minute 443/tcp, 0.0.0.0:32768->80/tcp blissful_mcleanThe 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 ps b9788c7adca3 nginx "nginx -g 'daemon ..." 43 hours ago Up 3 seconds 80/tcp, 443/tcp, 0.0.0.0:80->8080/tcp goofy_brahmagupta
Links
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.
docker官方文档中的dns,link,expose,publish的更多相关文章
- swift官方文档中的函数闭包是怎么理解的?
官方文档中的16页: numbers.map({ (number: Int) -> Int in let result = * number return result }) 不知道这个怎么用, ...
- swift官方文档中的switch中case let x where x.hasSuffix("pepper")是什么意思?
在官方文档中,看到这句.但不明白什么意思. let vegetable = "red pepper" switch vegetable { case "celery&qu ...
- 从官方文档中探索MySQL分页的几种方式及分页优化
概览 相比于Oracle,SQL Server 等数据库,MySQL分页的方式简单得多了,官方自带了分页语法 limit 语句: select * from test_t LIMIT {[offset ...
- 【Docker官方文档】理解Docker
本文来自Docker的官方文档,详细介绍了Docker的体系结构.重要概念.内部工作机理等内容,推荐不了解Docker内部原理的同学阅读. 什么是Docker? Docker是一个用于开发.交付和运行 ...
- tensorflow官方文档中的sub 和mul中的函数已经在API中改名了
在照着tensorflow 官方文档和极客学院中tensorflow中文文档学习tensorflow时,遇到下面的两个问题: 1)AttributeError: module 'tensorflow' ...
- 【采坑小计】thanos receiver的官方文档中,并未说明tsdb落盘的配置方式
官方文档的地址在:https://thanos.io/tip/components/receive.md/ 一开始以为落盘的时间间隔是:--tsdb.retention=15d 实际测试中发现,tha ...
- docker官方文档学习-1-Docker for mac安装配置
https://docs.docker.com/docker-for-mac/ Get started with Docker for Mac 首先像在本博客docker-1-环境安装及例子实践处将环 ...
- docker官方文档笔记
Docker在 CentOS7.X上运行.Docker可能在其他EL7的兼容版本中成功安装,但是官方并未进行测试,因此也不提供任何支持. 系统环境要求 docker必须运行在64-bit的系统上,对于 ...
- [Docker 官方文档] 理解 Docker
http://segmentfault.com/a/1190000002609286 什么是 Docker? Docker 是一个用于开发.交付和执行应用的开放平台,Docker 设计用来更快的交付你 ...
随机推荐
- 【Linux】——搭建nexus
1.安装 前提条件: JDK已经安装,运行java -version查看. 将本地下载好的nexus存放到linux上,存放路径为 /usr/local/software.可使用winscp直接拷贝. ...
- Win10 1803安装Ubuntu1804子系统
1.win10应用商店选择Ubuntu1804安装 点击打开会提示https://docs.microsoft.com/zh-cn/windows/wsl/install-win10 2.用管理员po ...
- C# 利用WMI对象获取物理内存和可用内存大小
下面的代码演示的是使用WMI对象可获取取物理内存和可用内存大小,在使用WMI对象前,先要添加对System.Management的引用,然后就可以调用WMI对象,代码如下: //获取总物理内存大小 M ...
- [LeetCode] 70. Climbing Stairs(斐波那契数列)
[思路] a.因为两种跳法,1阶或者2阶,那么假定第一次跳的是一阶,那么剩下的是n-1个台阶,跳法是f(n-1); b.假定第一次跳的是2阶,那么剩下的是n-2个台阶,跳法是f(n-2) c.由a.b ...
- servlet 接受和回复向服务器对客户端发起得请求
servlet 接受和回复向服务器对客户端发起得请求
- ASP.NET页面之间传值Cookie(3)
这个也是大家常使用的方法,Cookie用于在用户浏览器上存储小块的信息,保存用户的相关信息,比如用户访问某网站时用户的ID,用户的偏好等, 用户下次访问就可以通过检索获得以前的信息.所以Cookie也 ...
- [POJ 1204]Word Puzzles(Trie树暴搜&AC自己主动机)
Description Word puzzles are usually simple and very entertaining for all ages. They are so entertai ...
- MD5算法解析
MD5的全称是Message-Digest Algorithm 5,在90年代初由MIT的计算机科学实验室和RSA Data Security Inc发明,经MD2.MD3和MD4发展而来. MD5将 ...
- bzoj 1878
莫队乱搞的第一题,(感觉这个算法初学的时候就能想到啊) 总之就是离线,然后扫一遍然后回答,用数组记录状态 但还是有一个地方不太明白 为什么要除siz?这样为什么会优化复杂度呢?? bool cmp(c ...
- BZOJ3236: [Ahoi2013]作业 树状数组维护 莫队
水果~~~~ 关于四个while可行性的证明:区间有正确性所以不管那团小东西用没有duang~反它最终总会由于两次覆盖二准确 关于区间种数可行性的证明:他会在0 1间(或两边)来回跳动(过程中),最终 ...