您现在的位置是:貌合心离网 > 热点
云计算核心技术Docker教程:Docker 容器更改/etc/hosts文件
貌合心离网2026-11-14【热点】{固定数字1}人已围观
简介谷歌留痕外推【tg:seogoogle987】
除了环境变量之外,Docker 还在/etc/hosts文件中添加了源容器的主机条目。这是web 容器的条目:
$ docker run -t -i --r云计m --link db:webdb training/webapp /bin/bash
root@aed84ee21bde:/opt/webapp# ca算核t /etc/hosts
172.17.0.7 aed84ee21bde
<...>
172.17.0.5 webdb 6e5cdeb2d300心技 db
您可以看到两个相关的主机条目。第一个是web 使用容器 ID 作为主机名的容器条目。第二个条目使用链接别名来引用db容器的 IP 地址。除了您提供的别术D名之外,链接容器的名称(如果与提供给--link参数的别名不同)和链接容器的主机名也会被添加到/etc/hosts链接容器的 IP 地址。您可以通过以下任oc何条目 ping 该主机:
root@aed84ee21bde:/opt/webapp# apt-get install -yqq inetutils-pkeing
root@aed84ee21bde:/opt/webapp# ping webdb
PING webdb (172.17.0.5): 48 datar教 bytes
56 bytes from 172.17.0.5: icmp_seq=0 ttl=64 time=0.267 ms
56 bytes from 172.17.0程:.5: icmp_seq=1 ttl=64 time=0.250 ms
56 bytes from 172.17.0.5: icmp_seq=2 ttl=64 time=Do0.256 ms
注意:在示例中,您必须安装,ping因为它最初未包含在容器中。
在这里,您使用该ping命令db通过其主机条目ping容器,该条目解析ck为172.17.0.5. 您可以使用此主机条目来配置应用程序以使用您的db容器。
如果您重新启动源容器,/etc/hosts链接容器上的文件会自动更er新为源容器的新 IP 地址,从而允许链接通信继续。
$ docker restart db
db
$ docker run -t -i --rm --link db:db tr 容aining/webapp /bin/bash
root@aed84ee21bde:/opt/webapp# cat /etc/hosts
172.17.器更0.7 aed84ee21bde
<...>
172.17.0.9 db
很赞哦!(444)
上一篇: 标签: 鸿蒙智行 问界 华为 渠道调整
下一篇: 如何三步搭建一套声纹系统
热门文章
站长推荐
友情链接
- 标签: 康师傅
- https://www.safetv.go.kr/base/search/view?searchWord=谷歌留痕外推【tg:seogoogle987】Txb
- https://www.klatreverden.no/search?q=谷歌留痕外推【tg:seogoogle987】,pXp
- https://www.maigoo.com/search/?block=&q=谷歌留痕外推【tg:seogoogle987】,7cy
- https://www.spicebar.de/catalogsearch/result/?q=谷歌留痕外推【tg:seogoogle987】,MYp
- https://www.kawainter.com/catalogsearch/result/?q=谷歌留痕外推【tg:seogoogle987】,P2T
- https://www.military-history.org/?s=谷歌留痕外推【tg:seogoogle987】,SUl
- https://www.prattlibrary.org/search?q=谷歌留痕外推【tg:seogoogle987】,wbR
- https://www.tarleton.edu/?s=谷歌留痕外推【tg:seogoogle987】,8dp
- https://xn--lgernevedlystskoven-lxb.dk/search/谷歌留痕外推【tg:seogoogle987】,uab
- https://www.tycoonstory.com/?s=谷歌留痕外推【tg:seogoogle987】,5Bd
- https://www.oprny.com/search.php?search_query=谷歌留痕外推【tg:seogoogle987】,IYH
- https://dict.naver.com/dict.search?dicQuery&query=谷歌留痕外推【tg:seogoogle987】2kL
- https://www2.ual.es/ProyectoLates/?s=谷歌留痕外推【tg:seogoogle987】,dqO
- https://www.ussalabama.com/?action=CHECK&s=谷歌留痕外推【tg:seogoogle987】,SVo
- https://www.scivee.tv/?s=谷歌留痕外推【tg:seogoogle987】,Ypn
- https://www.varian.com/en-au/search?cat=113&search=谷歌留痕外推【tg:seogoogle987】,zer
- https://www.roberthalf.com/us/en/jobs/all/谷歌留痕外推【tg:seogoogle987】T5Q
- https://www.teamlab.art/es/?submit=谷歌留痕外推【tg:seogoogle987】,ngb
- https://www.thealexandrian.net/?s=谷歌留痕外推【tg:seogoogle987】,FQI
- https://www.wuv.edu/?s=谷歌留痕外推【tg:seogoogle987】,pnF
- https://www.paulaschoice.hk/zh_hant/catalogsearch/result/?q=谷歌留痕外推【tg:seogoogle987】,VWt
- https://www.roberthalf.com/us/en/jobs/all/谷歌留痕外推【tg:seogoogle987】tFn
- https://www.tailoy.com.pe/catalogsearch/result/?q=谷歌留痕外推【tg:seogoogle987】,Lnl
- https://www.olx.ba/pretraga?trazilica=谷歌留痕外推【tg:seogoogle987】,mut
- https://www.umc.edu/search.aspx?ID=I4gnDKRS991MFcIDDzoYze4aWSAszAm7&q=谷歌留痕外推【tg:seogoogle987】,O3k
- https://www.pmindia.gov.in/en/?s=谷歌留痕外推【tg:seogoogle987】,0R5
- https://www.udc.co.uk/index.php?route=product/search&sort=p.price&order=DESC&tag=谷歌留痕外推【tg:seogoogle987】,3iY
- https://www.remit.co.jp/id/?s=谷歌留痕外推【tg:seogoogle987】,t5d
- https://www.lindseymedicalsupply.com/search/谷歌留痕外推【tg:seogoogle987】,cLL
- https://www.youtube.com/results?search_query=谷歌留痕外推【tg:seogoogle987】,bLz
- https://www.laoairlines.com/?action=QUERY&s=谷歌留痕外推【tg:seogoogle987】,iFU
- https://www.qwant.com/?q=谷歌留痕外推【tg:seogoogle987】,1qt
- https://www.televes.com/es/catalogsearch/result/?q=谷歌留痕外推【tg:seogoogle987】,FjT
- https://www.localfootdoc.com/?s=谷歌留痕外推【tg:seogoogle987】,n3c
- https://www.kaiyueleather.com/search/谷歌留痕外推【tg:seogoogle987】,YRf
- https://www.yli.ro/catalogsearch/result/?q=谷歌留痕外推【tg:seogoogle987】,NEc
- https://www.youtube.com/hashtag/谷歌留痕外推【tg:seogoogle987】,2qf
- https://www.takachi-enclosure.com/search?eqYB=gnI31Ou&text=谷歌留痕外推【tg:seogoogle987】,mAJ
- https://www.qylaws.com/search/谷歌留痕外推【tg:seogoogle987】,52c
- https://www.unclefossil.com/search/谷歌留痕外推【tg:seogoogle987】gad_source=1&gclid=Cj0KCQjw_-GxBhC1ARIsADGgDjsNKplUXa2F6YGlHBK2sHDQ88cgsJBb05DyO99TV9jNq_cT0kGMqyQaAgHQEALw_wcB
- https://www.schenckprocess.com/search?q=谷歌留痕外推【tg:seogoogle987】,Tyy
- https://www.kyuhoshi.com/?s=谷歌留痕外推【tg:seogoogle987】,1sw
- https://www.swanagerailway.co.uk/search?q=谷歌留痕外推【tg:seogoogle987】,sHx
- https://www.mintos.org/?s=谷歌留痕外推【tg:seogoogle987】,Vtx
- https://blvdseafood.com/?s=谷歌留痕外推【tg:seogoogle987】SGR
- https://www.sbaad.no/search/谷歌留痕外推【tg:seogoogle987】,MGo
- https://www.rostaing.com/catalogsearch/result/?cat=22&q=谷歌留痕外推【tg:seogoogle987】,qoQ
- https://www.remit.co.jp/vi/?s=谷歌留痕外推【tg:seogoogle987】,CpM
- https://www.flickr.com/photos/tags/谷歌留痕外推【tg:seogoogle987】hvZ
- https://www.sweat.com/collections/vendors?q=谷歌留痕外推【tg:seogoogle987】,yQD







