我有一个这样的 yaml 文件:
local: &local
image: xxx
# *tons of config*
ci:
<<: *local
image: # delete
build: .
我要
ci
从 local
继承所有值,除了 image
.有没有办法“删除”这个值?
最佳答案
对于接受值列表的属性,您可以发送 []
作为值(value)。
例如在 docker-compose 你不想继承 ports
:
service_1: &service_1
# some other properties.
ports:
- "49281:22"
- "8876:8000"
# some other properties
service_2:
<<: *service_1
ports: [] # it removes ports values.
关于dictionary - 如何从 yaml 配置中删除继承属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40947887/