本文介绍了docker-compose.yml文件中的&符号的含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我最近遇到了这个问题,想知道& django
是什么意思
I recently came across this and was wondering what &django
means
version: '2'
services:
django: &django
在文档中,我看不到任何内容与此有关.
I can't see anything in the docs related to this.
推荐答案
这些是称为锚的YAML功能,并非Docker Compose特有.我建议您在URL下方查看更多详细信息
These are a YAML feature called anchors, and are not particular to Docker Compose. I would suggest you have a look at below URL for more details
https://learnxinyminutes.com/docs/yaml/
按照部分 EXTRA YAML功能
anchored_content:& anchor_name 该字符串将显示为两个键的值.other_anchor: * anchor_name
anchored_content: &anchor_name This string will appear as the value of two keys. other_anchor: *anchor_name
锚点可用于复制/继承属性
base: &base
name: Everyone has same name
foo: &foo
<<: *base
age: 10
bar: &bar
<<: *base
age: 20
这篇关于docker-compose.yml文件中的&符号的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!