In Docker-build in the man page, the argument tag is mentioned.
-t|--tag[=[]]
What does [=[]] mean exactly?
CodePudding user response:
The tags can be unset, which is why the entire option is nested in square brackets. The syntax looks a bit strange to me, and may not follow the syntax used in other man pages, but when set, tag can be set to an array of strings. You do this by passing the tag option multiple times:
docker build --tag myapp:v1 --tag myapp:latest .
So my reading of the inner brackets in the man pages is it's indicating the option accepts multiple values.
CodePudding user response:
I assume by the man page
, you mean
The extra brackets you see in the ArchLinux page simply denote the usage of -t
/ --tag
. The outermost brackets (only the right-hand one is shown in your example) denote separation from the other commands, grouping the -t
and --tag
flag together for the same command result (note the pipe). The middle brackets denote that there are options for the flag. The innermost brackets denote that the array of valid values for the options. In the case of --tag
, there are no valid options, so the array is empty.
This can (arguably) be more readably expressed as: --tag [TAG_NAME]