您现在的位置是:热点 >>正文
云计算核心技术Docker教程:Docker 容器更改/etc/hosts文件
热点5701899人已围观
简介...
除了环境变量之外,Docker 还在/etc/hosts文件中添加了源容器的主机条目。这是web 容器的条目:
$ docker run -t -i --r云计m --link db:webdb training/webapp /bin/bash
root@aed84ee21bde:/opt/webapp# cat /算核etc/hosts
172.17.0.7 aed84ee21bde
<...>
172.17.0.5 webdb 6e5cdeb2d300 db
您可以心技看到两个相关的主机条目。第一个是web 使用容器 ID 作为主机名的容器条目。第二个条目使用链接别名来引用db容器的 IP 地址。除了您提供的别名之外,链接容术D器的名称(如果与提供给--link参数的别名不同)和链接容器的主机名也会被添加到/etc/hosts链接容器的 IP 地址。您可以通过以下任何条目 pinocg 该主机:
root@aed84ee21bde:/opt/webapp# apt-get install -yqq inetutils-ping
root@keaed84ee21bde:/opt/webapp# ping webdb
PING webdb (172.17.0.5): 48 data bytes
56 br教ytes from 172.17.0.5: icmp_seq=0 ttl=64 time=0.267 ms
56 bytes from 172.17.0.5: ic程:mp_seq=1 ttl=64 time=0.250 ms
56 bytes from 172.17.0.5: icmp_seq=2 ttl=64 time=0Do.256 ms
注意:在示例中,您必须安装,ping因为它最初未包含在容器中。
在这里,您使用该ping命令db通过其主机条目ping容器,该条目解析为17ck2.17.0.5. 您可以使用此主机条目来配置应用程序以使用您的db容器。
如果您重新启动源容器,/etc/hosts链接容器上的文件会自动更新为源er容器的新 IP 地址,从而允许链接通信继续。
$ docker restart db
db
$ docker run -t -i --rm --link db:db traini 容ng/webapp /bin/bash
root@aed84ee21bde:/opt/webapp# cat /etc/hosts
172.17.0.7 a器更ed84ee21bde
<...>
172.17.0.9 db
Tags:
相关文章
零样本性能超越小样本,谷歌1370亿参数新模型比GPT-3更强
热点在 NLP 领域,pretrain-finetune 和 prompt-tuning 技术能够提升 GPT-3 等大模型在各类任务上的性能,但这类大模型在零样本学习任务中的表现依然不突出。为了进一步挖...
【热点】
阅读更多标签: 医脉通 人工智能+医学研究 北京市自然科学基金 朝阳创新联合基金
热点云梦级3月26日云梦级消息,医脉通(02192.HK)公告,截至2025年12月31日止年度,集团的收入约人民币6.42亿元,较去年增长15.0%。集团的母公司拥有人应占溢利由约人民币3.15亿元增加...
【热点】
阅读更多标签: 电影 春节档
热点撰文 | 程书书 编辑 | 李信马 题图 | 豆包AI 2026年春节档,中国电影市场上演了一出魔幻现实主义大戏。 影院里空荡荡,总票房仅为57.52亿元,同比暴跌39.5%,直接回到了2018年;观...
【热点】
阅读更多
热门文章
最新文章
友情链接
- 标签: 康师傅
- https://zhidao.baidu.com/index/?action=QUERY&word=谷歌站群软件【tg:seogoogle987】,q0d
- https://www.swecobelgium.be/?page=9&s=谷歌站群软件【tg:seogoogle987】,L5d
- https://m.shoppinghow.kakao.com/m/search/q/谷歌站群软件【tg:seogoogle987】R5M
- https://www.theaerogroup.net/?cat=28&s=谷歌站群软件【tg:seogoogle987】,vnW
- https://www.tombow.com/search/谷歌站群软件【tg:seogoogle987】,pIE
- https://www.navymwr.org/search/?query=谷歌站群软件【tg:seogoogle987】,ORR
- https://www.teamlab.art/it/?submit=谷歌站群软件【tg:seogoogle987】,pni
- https://www.paxnet.co.kr/search/jongmok?kwd=谷歌站群软件【tg:seogoogle987】ufA
- https://www.tumblr.com/tagged/谷歌站群软件【tg:seogoogle987】,VLX
- https://www.lneg.pt/en/?s=谷歌站群软件【tg:seogoogle987】,BtE
- https://www.usslexington.com/?action=QUERY&s=谷歌站群软件【tg:seogoogle987】,DJW
- https://www.lindseymedicalsupply.com/search/谷歌站群软件【tg:seogoogle987】,A00
- https://www.simcoemuskokahealth.org/SearchResults.aspx?SearchQuery=谷歌站群软件【tg:seogoogle987】,XkH
- https://www.oikos-tecnics.com/?s=谷歌站群软件【tg:seogoogle987】,oH6
- https://www.tmtpost.com/search?q=谷歌站群软件【tg:seogoogle987】,csU
- https://www.luxurysociety.com/en/search?q=谷歌站群软件【tg:seogoogle987】,csD
- https://www.paspaley.com/catalogsearch/result/?action=QUERY&q=谷歌站群软件【tg:seogoogle987】,mpL
- https://www.kissthekangaroo.com.au/index.php?route=product/search&tag=谷歌站群软件【tg:seogoogle987】,3yw
- https://www.resilienz-akademie.com/?cat=71&s=谷歌站群软件【tg:seogoogle987】,wAu
- https://www.rea.govt.nz/search?searchterm=谷歌站群软件【tg:seogoogle987】,T05
- https://www.unclefossil.com/search/谷歌站群软件【tg:seogoogle987】gad_source=1&gclid=Cj0KCQjw_-GxBhC1ARIsADGgDjsNKplUXa2F6YGlHBK2sHDQ88cgsJBb05DyO99TV9jNq_cT0kGMqyQaAgHQEALw_wcB
- https://www.metalmensales.com/?action=QUERY&s=谷歌站群软件【tg:seogoogle987】,QqP
- https://www.sic-info.org/?s=谷歌站群软件【tg:seogoogle987】,FtL
- https://www.mdbg.net/chinese/dictionary?page=worddict&wdrst=0&wdqb=谷歌站群软件【tg:seogoogle987】,DYW
- https://www.yr.no/en/search?q=谷歌站群软件【tg:seogoogle987】,WwE
- https://www.parl.ca/legisinfo/fr/projets-de-loi?parlsession=all&view=list&keywords=谷歌站群软件【tg:seogoogle987】,Tki
- https://www.mingwai.edu.hk/?langzh-hant&s=谷歌站群软件【tg:seogoogle987】,C10
- https://www.nuovabai.it/catalogsearch/result/?action=SEARCH&q=谷歌站群软件【tg:seogoogle987】,n6y
- https://www.polar-tech.com/?action=QUERY&s=谷歌站群软件【tg:seogoogle987】,Ois
- https://www.military-history.org/?s=谷歌站群软件【tg:seogoogle987】,YAg
- https://www.yidian51.com/taobao/谷歌站群软件【tg:seogoogle987】,dzq
- https://www.qylaws.com/search/谷歌站群软件【tg:seogoogle987】,j9o
- https://www.springfieldlibrary.org/?s=谷歌站群软件【tg:seogoogle987】,Nd0
- https://www.oprny.com/search.php?search_query=谷歌站群软件【tg:seogoogle987】,mZ2
- https://www.revere.org/search?action=SEARCH&q=谷歌站群软件【tg:seogoogle987】,3TU
- https://www.vivaraise.fr/catalogsearch/result/?q=谷歌站群软件【tg:seogoogle987】,aQV
- https://www.reginatangoshoes.com/en/catalogsearch/result/index/?T=1686132113407&q=谷歌站群软件【tg:seogoogle987】,B5m
- https://store.line.me/search/sticker/ja?q=谷歌站群软件【tg:seogoogle987】7Ho
- https://www.realsporting.com/buscador?buscar=谷歌站群软件【tg:seogoogle987】,DL9
- https://www.lezhin.com/ko/tags/谷歌站群软件【tg:seogoogle987】,3Cm
- https://www.ucycle.com/search/=谷歌站群软件【tg:seogoogle987】,8Op
- https://www.teamlab.art/es/?submit=谷歌站群软件【tg:seogoogle987】,f3I
- https://www.ons.gov.uk/search?q=谷歌站群软件【tg:seogoogle987】,eMu
- https://www.dba.dk/soeg/?soeg=谷歌站群软件【tg:seogoogle987】vBI
- https://www.ushmm.org/search/results/?ID=8s0587Oi8UTv74zPPM4fuhwjNpe2hsEE&q=谷歌站群软件【tg:seogoogle987】,Z9t
- https://www.synonyms.com/antonyms/谷歌站群软件【tg:seogoogle987】,jND
- https://www.supersauna.de/catalogsearch/result/?q=谷歌站群软件【tg:seogoogle987】,SKz
- https://www.stormberg.com/no/search?q=谷歌站群软件【tg:seogoogle987】,1S5
- https://www.pmindia.gov.in/en/?s=谷歌站群软件【tg:seogoogle987】,7Ph
- https://www.therapeuticassociates.com/?cat=5&s=谷歌站群软件【tg:seogoogle987】,v2d