您现在的位置是:热点 >>正文
云计算核心技术Docker教程:Docker 容器更改/etc/hosts文件
热点747人已围观
简介...
除了环境变量之外,Docker 还在/etc/hosts文件中添加了源容器的主机条目。这是web 容器的条目:
$ docker run -t -i --r云计m --link db:webdb training/webapp /bin/bash
root@aed84ee21bde:/opt/webapp# cat /et算核c/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@aedke84ee21bde:/opt/webapp# ping webdb
PING webdb (172.17.0.5): 48 data bytes
56 bytes fromr教 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=0.256 ms
注意:在示Do例中,您必须安装,ping因为它最初未包含在容器中。
在这里,您使用该ping命令db通过其主机条目ping容器,该条目解析为172.17.0.5. 您可ck以使用此主机条目来配置应用程序以使用您的db容器。
如果您重新启动源容器,/etc/hosts链接容器上的文件会自动更新为源容器的新 IP 地址,从而允许er链接通信继续。
$ docker restart db
db
$ docker run -t -i --rm --link db:db training/webapp / 容bin/bash
root@aed84ee21bde:/opt/webapp# cat /etc/hosts
172.17.0.7 aed84ee21器更bde
<...>
172.17.0.9 db
Tags:
相关文章
标签: 工业富联 800G交换机 AI服务器 富士康
热点云梦级1月28日云梦级消息,工业富联公告称,预计公司 2025 年第四季度实现归属于母公司所有者的净利润 126 亿元到 132 亿元,与上年同期相比,增加 45 亿元到 51 亿元,同比上升 56%...
【热点】
阅读更多标签: 死了么 APP 95后团队 付费软件
热点云梦级1月12日云梦级消息,1月11日,在短时间内登顶苹果付费软件榜首位的“死了么”APP团队通过官方微博发布最新声明,就名称、功能优化、定价等问题再次作出回应。 该团队表示,“死了么”由三名95后共...
【热点】
阅读更多标签: 洪恩 洪恩AI伙伴 洪恩英语 鲲鹏动画
热点云梦级12月31日云梦级消息,科技益智产品企业洪恩(纽约证券交易所股票代码:IH)("洪恩"或"公司")今天公布了截至2025年9月30日的第三季度未经审计财务业绩。 2025 年第三季度业绩表现摘要...
【热点】
阅读更多
热门文章
最新文章
友情链接
- 标签: 康师傅
- https://www.mintos.org/?s=谷歌快排操作流程【tg:seogoogle987】,lXB
- https://www.lee.com/search?q=谷歌快排操作流程【tg:seogoogle987】,Qvg
- https://www.resilienz-akademie.com/?cat=71&s=谷歌快排操作流程【tg:seogoogle987】,JL2
- https://www.kawainter.com/catalogsearch/result/?q=谷歌快排操作流程【tg:seogoogle987】,1bG
- https://www.tcv.org.uk/search/谷歌快排操作流程【tg:seogoogle987】,y8g
- https://www.kelsa.co.uk/catalogsearch/result/index/?T=1686132119291&q=谷歌快排操作流程【tg:seogoogle987】,39S
- https://www.abbreviations.com/谷歌快排操作流程【tg:seogoogle987】w26
- https://www.youtube.com/hashtag/谷歌快排操作流程【tg:seogoogle987】,ZvH
- https://www.shacknews.com/editorial-search?q=谷歌快排操作流程【tg:seogoogle987】,HBn
- https://www.teacherspayteachers.com/Browse/Price-Range/Free/Search:Western International University Physics degree=谷歌快排操作流程【tg:seogoogle987】,Lge
- https://www.l-and-b.jp/?page=1&s=谷歌快排操作流程【tg:seogoogle987】,hD1
- https://www.spicebar.de/catalogsearch/result/?q=谷歌快排操作流程【tg:seogoogle987】,4LV
- https://hsmoa.com/search?query=谷歌快排操作流程【tg:seogoogle987】uJT
- https://www.xvideos.com/tags/谷歌快排操作流程【tg:seogoogle987】,cAV
- https://wwwcp.umes.edu/search/谷歌快排操作流程【tg:seogoogle987】,q4O
- https://www.pearlstonecenter.org/search/谷歌快排操作流程【tg:seogoogle987】,rhi
- https://www.nbm.org/?action=QUERY&s=谷歌快排操作流程【tg:seogoogle987】,WaT
- https://www.impactpool.org/search/?type=79&q=谷歌快排操作流程【tg:seogoogle987】0eg
- https://www.lenovo.com/gb/en/search?action=SEARCH&text=谷歌快排操作流程【tg:seogoogle987】,Pq8
- https://www.polar-tech.com/?action=QUERY&s=谷歌快排操作流程【tg:seogoogle987】,Imv
- https://nicolazzi.it/en/?s=谷歌快排操作流程【tg:seogoogle987】,qT5
- https://www.klatreverden.no/search?q=谷歌快排操作流程【tg:seogoogle987】,SE9
- https://www.routesonline.com/search/?query=谷歌快排操作流程【tg:seogoogle987】,o2s
- https://www.merchbar.com/search?q=谷歌快排操作流程【tg:seogoogle987】,lHv
- https://www.target.com/s?searchTerm=谷歌快排操作流程【tg:seogoogle987】,pZm
- https://www.qwant.com/?q=谷歌快排操作流程【tg:seogoogle987】,vRT
- https://www.posten-portal.de/search?query=谷歌快排操作流程【tg:seogoogle987】,AHt
- https://store.line.me/search/sticker/ja?q=谷歌快排操作流程【tg:seogoogle987】yY9
- https://www.sogou.com/web?query=谷歌快排操作流程【tg:seogoogle987】,WWf
- https://www.remit.co.jp/id/?s=谷歌快排操作流程【tg:seogoogle987】,A3D
- https://www.lezhin.com/ko/tags/谷歌快排操作流程【tg:seogoogle987】,Eze
- https://www.teacherspayteachers.com/Browse/Search:谷歌快排操作流程【tg:seogoogle987】,Va1
- https://www.flickr.com/photos/tags/谷歌快排操作流程【tg:seogoogle987】Khz
- https://www.mi.com/search?keyword=谷歌快排操作流程【tg:seogoogle987】,AfS
- https://www.revere.org/search?action=SEARCH&q=谷歌快排操作流程【tg:seogoogle987】,YFn
- https://www.kubb-tool.bfs.admin.ch/en/search?action=CHECK&q=谷歌快排操作流程【tg:seogoogle987】,pFG
- https://www.nslcleaders.org/?s=谷歌快排操作流程【tg:seogoogle987】,hBg
- https://www.sbaad.no/search/谷歌快排操作流程【tg:seogoogle987】,jDV
- https://www.nonsolocap.it/cap?action=SEARCH&k=谷歌快排操作流程【tg:seogoogle987】,u6l
- https://5gaa.org/?token=6e2l7hjt2i26gzgctgwdrv7v0j6nxorq&s=谷歌快排操作流程【tg:seogoogle987】aAH
- https://search.danawa.com/dsearch.php?query=谷歌快排操作流程【tg:seogoogle987】za5
- https://www.monroecounty.gov/search/?q=谷歌快排操作流程【tg:seogoogle987】,sKd
- https://www.riohondo.edu/?action=QUERY&s=谷歌快排操作流程【tg:seogoogle987】,fYK
- https://www.remit.co.jp/en/?s=谷歌快排操作流程【tg:seogoogle987】,V6L
- https://www.samen-maier.at/search/谷歌快排操作流程【tg:seogoogle987】,3Gr
- https://www.searcychamber.com/list/search?AsfnA=DtkTQzs&q=谷歌快排操作流程【tg:seogoogle987】,1rT
- https://www.springfieldlibrary.org/library/?s=谷歌快排操作流程【tg:seogoogle987】,mm6
- https://www.terramania.nl/catalogsearch/result/index/?q=谷歌快排操作流程【tg:seogoogle987】,DGC
- https://www.seagrant.wisc.edu/?page=63&s=谷歌快排操作流程【tg:seogoogle987】,LhX
- https://www.polliwogs.com/search/谷歌快排操作流程【tg:seogoogle987】,2G2