Command can also be a list. Without an example this is not very helpful.
How can I specify to run two commands?
Share and learn in the Docker community.
Command can also be a list. Without an example this is not very helpful.
How can I specify to run two commands?
The compose file is a yaml file and the âlistâ means the list syntax in yaml. I guess this is why there is no better example, except a reference to an empty list:
If the value is
[](empty list)
You can find better examples in the Yaml syntax documentation, but it seems it is officially called âcollectionâ so that could be confusing without an example in the Docker compose documentation.
https://yaml.org/spec/1.2.2/#22-structures
It is called âlistâ in the Ansible documentation that uses the same syntax:
https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html#yaml-basics
Since you noticed thi documentation problem, it would help a lot if you could click on the âRequest changesâ link in the top right corner in the documentation and describe what you would like to be added or explained in the documentation that is missing now.
To give you a short answer without the ned to read multiple documentations:
command:
- curl
- -L
- http://example.org
Or a special mixed syntax:
command:
- sh
- -c
- |
curl -L http://example.org --output out.txt
cat out.txt
this can help you avoid using quotes
The point is that you use a new list item instead of separating the parts of the command with a space character. This is indeed a detail which should be mentioned even if someone knows what a list in yaml is.