skip to Main Content

In Docker-build in the man page, the argument tag is mentioned.

-t|--tag[=[]]

What does [=[]] mean exactly?

2

Answers


  1. I assume by the man page, you mean this ArchLinux page:

    ArchLinux

    If you look at the official documentation, you can see it just references -t:

    -t

    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]

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search