您现在的位置是:热点 >>正文
云计算核心技术Docker教程:docker-compose扩展配置
热点05427人已围观
简介...
Docker Compose的extends关键字允许在不同文件甚至整个项目之间共享通用配置。如果您有多个服务可以重用一组通用的配置选项,则扩展服务很有用。使用extends您可以在一个地方定义一组通用的服务选云计项,并可以从任何地方引用它。
请记住,volumes_from并且depends_on永远不会在使用的服务之间共享extends。这些异常的存在是为了避免隐式依赖性。您总是volumes_from在本地定义。这样可以确算核保在读取当前文件时,服务之间的依赖关系清晰可见。在本地定义这些文件还可以确保对引用文件的更改不会破坏任何内容。
在中定义任何服务时docker-compose.yml,您可以声明要扩展另一个服务,如下所示:
we心技b:
extends:
file: common-services.yml
&术Dnbsp; service: webapp
这指示Compose重新使用webapp该common-services.yml文件中定义的服务的配置。假设common-services.yml 看起来像这oc样:
webapp:
build: .
ports:
- "8000:8000"
&nbskep; volumes:
- "/data"
在这种情况下,您获得的结果与使用编写 docker-compose.yml的完全相同build,r教ports并且volumes直接在之下定义了配置值web。
您可以在以下位置进一步定义本地配置(或重新定义) docker-compose.yml:
web:
extends:
&n程:bsp; file: common-services.yml
service: webapp
&donbsp; environment:
- DEBUG=1
cpu_shares: 5
important_ckweb:
extends: web
cpu_shares: 10
您还可以编写其他服务并将您的web服务链接到它们:
web:
&nbserp; extends:
file: common-services.yml
service: webap-cp
environment:
- DEBUG=1
cpu_shares: 5
&nombsp; depends_on:
- db
db:
image: postgres
Tags:
相关文章
鑳戒笌 GPT-3 鐩稿�缇庯紵EleutherAI 寮€婧� GPT-J
热点2020 骞达紝寰�蒋涓� OpenAI 杈炬垚浜嗗崗璁�紝寰�蒋灏嗘嫢鏈夊� GPT-3 婧愪唬鐮佺殑鐙��璁块棶鏉冿紝鑷�� OpenAI 灏变笉鍍忎互寰€涓€鏍峰紑鏀惧叾 GPT-3 AI 妯″...
【热点】
阅读更多标签: 哈啰单车 天津交通委 共享单车 互联网租赁自行车
热点云梦级4月1日云梦级消息,4月1日,天津交通运输微信公众号发布了“关于约谈哈啰单车运营企业的公告”,全文如下——2026年3月31日,天津市交通运输委员会就互联网租赁自行车(以下简称共享单车)超量投放...
【热点】
阅读更多标签: Meta AI智能体 AndrewBosworth ATA
热点云梦级5月19日云梦级消息,据路透社报道,Meta 计划于当地时间 5 月 20 日(周三)在全球范围内裁员 10%,同时进行新一轮组织架构调整,旨在优化公司的人工智能工作流程。 Meta 首席人事官...
【热点】
阅读更多
热门文章
最新文章
友情链接
- 标签: 康师傅
- https://www.mesec.cz/vyhledavani/?qs=谷歌留痕软件【tg:seogoogle987】,6vn
- https://www.teacherspayteachers.com/Browse/Price-Range/Free/Search:谷歌留痕软件【tg:seogoogle987】,hEF
- https://www.teamlab.art/fr/?submit=谷歌留痕软件【tg:seogoogle987】,8Jj
- https://www.usslexington.com/?action=QUERY&s=谷歌留痕软件【tg:seogoogle987】,PXo
- https://www.selfsufficientish.com/main/?s=谷歌留痕软件【tg:seogoogle987】,0r3
- https://www.remit.co.jp/id/?s=谷歌留痕软件【tg:seogoogle987】,G2U
- https://www.u-bourgogne.fr/?cat=117&s=谷歌留痕软件【tg:seogoogle987】,aVa
- https://www.tumblr.com/tagged/谷歌留痕软件【tg:seogoogle987】,lw4
- https://www.zutari.com/search/谷歌留痕软件【tg:seogoogle987】,jiC
- https://www.supersauna.de/catalogsearch/result/?q=谷歌留痕软件【tg:seogoogle987】,4Qm
- https://www.rollingstone.it/?ID=DVMeu3AlmzZE1cuJ2FmgmO5TSCQRb3yh&s=谷歌留痕软件【tg:seogoogle987】,RSW
- https://www.manga-news.com/index.php/recherche/?q=谷歌留痕软件【tg:seogoogle987】,4ES
- https://www.prattlibrary.org/search?q=谷歌留痕软件【tg:seogoogle987】,Oev
- https://www.youtube.com/hashtag/谷歌留痕软件【tg:seogoogle987】,ok9
- https://www.reginatangoshoes.com/en/catalogsearch/result/index/?T=1686132113407&q=谷歌留痕软件【tg:seogoogle987】,JCT
- https://www.remit.co.jp/en/?s=谷歌留痕软件【tg:seogoogle987】,BiD
- https://www.welshmountainzoo.org/shop/index.php?routeproduct/search&tag=谷歌留痕软件【tg:seogoogle987】,2gs
- https://www.vietnamconsulate-sf.org/?action=CHECK&s=谷歌留痕软件【tg:seogoogle987】,vQv
- https://www.sbaad.no/?s=谷歌留痕软件【tg:seogoogle987】,xpb
- https://www.openstreetmap.org/search?query=谷歌留痕软件【tg:seogoogle987】,mB4
- https://www.nonsolocap.it/cap?action=SEARCH&k=谷歌留痕软件【tg:seogoogle987】,vLL
- https://www.yr.no/en/search?q=谷歌留痕软件【tg:seogoogle987】,Det
- https://www.nytimes.com/search?dropmab=true&query=谷歌留痕软件【tg:seogoogle987】,2Wg
- https://www.universal-music.co.jp/?ID=1sIcckCTeBS8FjzCshAW9w53s8gr691o&s=谷歌留痕软件【tg:seogoogle987】,ol3
- https://www.smarty.net/search?q=谷歌留痕软件【tg:seogoogle987】,JMj
- https://hsmoa.com/search?query=谷歌留痕软件【tg:seogoogle987】mnk
- https://www.flickr.com/photos/tags/谷歌留痕软件【tg:seogoogle987】ekY
- https://www.lgnewsroom.com/search/谷歌留痕软件【tg:seogoogle987】,lB5
- https://yscc1986.net/search/谷歌留痕软件【tg:seogoogle987】mxU
- https://www.kaliastyle.com/catalogsearch/result/?q=GOOGLE谷歌留痕软件【tg:seogoogle987】,Mcz
- https://www.springfieldlibrary.org/?s=谷歌留痕软件【tg:seogoogle987】,h5g
- https://www.ushmm.org/search/results.php?q=谷歌留痕软件【tg:seogoogle987】,CsL
- https://www.navylookout.com/?ID=nSBR6Ivdu6lZg1yr2SDs30Lo5sTs76yJ&s=谷歌留痕软件【tg:seogoogle987】,Ndf
- https://5gaa.org/?token=6e2l7hjt2i26gzgctgwdrv7v0j6nxorq&s=谷歌留痕软件【tg:seogoogle987】FBj
- https://www.scq.ubc.ca/?page=2&s=谷歌留痕软件【tg:seogoogle987】,Oi3
- https://www.tmtpost.com/search?q=谷歌留痕软件【tg:seogoogle987】,8OG
- https://www.kaiyueleather.com/search/谷歌留痕软件【tg:seogoogle987】,KRp
- https://www.target.com/s?searchTerm=谷歌留痕软件【tg:seogoogle987】,MAr
- https://wwwcp.umes.edu/search/谷歌留痕软件【tg:seogoogle987】,Kk3
- https://www.nyif.com/catalogsearch/result/?q=谷歌留痕软件【tg:seogoogle987】,70B
- https://www.lee.com/search?q=谷歌留痕软件【tg:seogoogle987】,ZuW
- https://www.miamiopenmri.com/?action=CHECK&s=谷歌留痕软件【tg:seogoogle987】,HVY
- https://www.samen-maier.at/search/谷歌留痕软件【tg:seogoogle987】,CPM
- https://www.randjleather.co.uk/index.php?route=product/search&tag=谷歌留痕软件【tg:seogoogle987】,K4u
- https://www.paxnet.co.kr/search/jongmok?kwd=谷歌留痕软件【tg:seogoogle987】Q5O
- https://www.vivaraise.fr/catalogsearch/result/?q=谷歌留痕软件【tg:seogoogle987】,C8J
- https://www.wellbees.com/catalogsearch/result/?action=CHECK&q=谷歌留痕软件【tg:seogoogle987】,OpQ
- https://www.scivee.tv/?s=谷歌留痕软件【tg:seogoogle987】,W70
- https://www.duksung.ac.kr/search/front/Search.jsp?qt=谷歌留痕软件【tg:seogoogle987】ZR5
- https://www.kuaikanmanhua.com/sou/谷歌留痕软件【tg:seogoogle987】,Tai