Docker-2:network containers
docker run -d -P --name web training/webapp python app.py # -name means give the to-be-run container a name 'web'. -P means connect web to default network space bridge
docker network ls
docker run -itd --name=networktest ubuntu #container named networktest from image ubuntu has defaultly connected to bridge
docker network inspect bridge
docker network create -d bridge my-bridge-network #create a new network space "my-bridge-network" with network type "bridge", the other type is "overlay".
docker network ls
docker network inspect my-bridge-network
docker run -d --network=my-bridge-network --name db training/webapp #run container "db" and add it to my-bridge-network
docker inspect my-bridge-network
docker inspect --format='{{json .NetworkSettings.Networks}}' db # check the networking of container db
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' db # check the networking of container db
docker run -d -P --name web training/webapp python app.py # start a container web in net space "bridge"
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' web # check the networking of container web
docker exec -it db bash #run container db with bash cmd #in the container, we use ping ip_of_web, it fails for web is in bridge while db is in my-bridge-network, eventhough both web and db containers are from the SAME image
docker network connect my-bridge-network web #now connect web to my-bridge-network,Docker networking allows you to attach a container to as many networks as you like.
docker exec -it db bash #run container db with bash cmd, use ping web. succeed cause web and db are in the same network
Docker-2:network containers的更多相关文章
- (转)Docker - 创建 Docker overlay network (containers 通信)
原文链接: http://www.cnblogs.com/AlanWalkOn/p/6101875.html --- 创建基于Key-Value的Docker overlay network. 这样运 ...
- Docker Network containers
Network containers Estimated reading time: 5 minutes If you are working your way through the user gu ...
- 【Network】Calico, Flannel, Weave and Docker Overlay Network 各种网络模型之间的区别
From the previous posts, I have analysed 4 different Docker multi-host network solutions - Calico, F ...
- Docker container network configuration
http://xmodulo.com/networking-between-docker-containers.html How to set up networking between Docker ...
- docker - 关于network的一些理解
docker 提供给我们多种(4种)网络模式,我们可以根据自己的需求来使用.例如我们在一台主机(host)或者同一个docker engine上面运行continer的时候,我们就可以选择bridge ...
- Docker6之Network containers
how to network your containers. Launch a container on the default network Docker includes support fo ...
- [Docker] Running Multiple Containers for an Angular, Node project
The code is from Plusight course, github link is here. In this post, we will give a overview about h ...
- docker 解决network has active endpoints
解决方式 使用 docker network disconnect -f {network} {endpoint-name},其中的 {endpoint-name} 可以使用命令 docker net ...
- ASP.NET Core 2.0 in Docker on Windows Containers
安装Docker for Windows https://store.docker.com/editions/community/docker-ce-desktop-windows 要想将一个ASP. ...
随机推荐
- 设置MYECLIPSE的自动补全
http://jingyan.baidu.com/article/d169e1869caf1e436611d8db.html
- autolayout
autolayout.因为之前都是用frame,用代码来做,并且在布局时也很少用storyboard和xib.使得我再这方便经验很欠缺,想用,但是又怕用不好,出现各种意想不到的bug.但是又忽然想到, ...
- python 常用高效代码写法集锦
一.打开文件 #使用 with 语句操作文件对象 with open(r'somefileName') as somefile: for line in somefile: print line # ...
- 学校系统快速js代码
var select_arr=document.getElementById("iframeautoheight").contentWindow.document.getEleme ...
- 【转载】[C#]Log4net中的RollingFileAppender解析
Log4日志组件的应用确实简单实用,在比较了企业库和Log4的日志功能后,个人觉得Log4的功能更加强大点.补充说明下,我使用的企业库是2.0版本,Log4net是1.2.1版本的. 在Log4net ...
- unkow jdbc driver : http://maven.apache.org
报了这么一个错,找了很久才找到问题出在哪里,具体为什么会什么出现现在还不怎么懂,只是现在能让它继续跑起来 这个错是因为我的spring-mybatis.xml文件读取不了jdbc.properties ...
- 使用用Generic.xaml加载默认的主题资源
把Resource嵌入到Generic.xaml文件中,并把该文件放到应用程序的Themes主题文件夹下面,这们Generic.xaml文件中的资源就可以被系统识别为默认主题一部分,从而进行使用. 为 ...
- android中dx、dp、dip、sp单位的区别
1.dp=dip 2.px基于像素,后两者基于像素密度. 3.px既可用于宽度高度,也可用于字体,dp用于宽高,sp用于字体4.android中以320*480屏幕为基准.在相同值的px和dp,在32 ...
- 传输层(3)-缓冲区大小及限制、TCP输出
3.缓冲区大小及限制 影响IP数据报大小的限制. 1)IPv4数据报,最大大小是65535. 2)硬件规定的MTU.以太网的MTU是1500字节.SLIP链路1006字节或296字节 3)路径MTU. ...
- 21.2 Partitioning Types
分区类型: range:根据列值得一个给定的范围 list:和range相似,除了分区被选择基于的列被匹配在一个被设定为分离的值 hash 基于列组成的表达式返回的非负值 key 相似hash ,除 ...