In the YAML specs you can do either of these. Is it the same confusion as docker's cmd vs exec forms for ENTRYPOINT?
command: ["cmd1", "cmd2"]
args: ["arg1", "arg2"]
vs
command:
- cmd1
- cmd1
args:
- arg1
- arg2
The two notations are exactly the same; in YAML, they're both valid representations of a list (remember that YAML is a superset of JSON, so every valid JSON construct is also valid in YAML).
The first notation (["cmd1", "cmd"]
) is called a flow sequence in the official specification, while the second notation (- cmd1 ...
) is a block sequence. They are both parsed into the exact same data structure. Using one over the other is just a matter of taste.