Terminal (bash?) / Docker: logic behind – and —

For three days I am learning to work with Docker.
During this I ran commands like

sudo docker run --rm -ti --net=example --name server ubuntu:14.04 bash 

and

  • Where are data stored in a clustered environment?
  • How do you add authentication to a docker image?
  • Node Docker Container - Pulls from Git Repo for Node App Source Upon Running
  • How can I run containers detached and have them automatically removed when they exit?
  • Docker gd module for PHP 7
  • outcome of Running two dockerfiles
  •  nc -lp 1234
    

    I was wondering why I have to use sometimes a - and for other commands a --
    Is there any logic?

    Regarding the topic of my question: I am aware that it is not a good topic. I am sorry for that. This question occurred while working with Docker but I do not know if the - or -- thematic is more a terminal or docker topic.

  • Difference between Running and Starting a Docker container
  • Installing R Language on Ubuntu 16 - unmet dependencies
  • Docker Consul service ip advertised as internal docker ip
  • Cannot dump a database in a mysql container
  • How to assign specific IP to container and make that accessible outside of VM host?
  • docker for mac failed to start
  • 2 Solutions collect form web for “Terminal (bash?) / Docker: logic behind – and —”

    It depends on the command. There are conventions, but none of them are followed universally.

    In the Old Days, options were single letters. If an option took an argument, it could follow the option letter with or without an intervening space (command -x foo or command -xfoo).

    Options that don’t take arguments can be bundled, so command -x -y can be written as command -xy. For many commands, even options that do take arguments can be bundled, with the last specified option taking the argument: command -x -y foo vs. command -xy foo. The nc -lp 1234 in your question is an example of this; l and p are two different options. That could also have been written as nc -l -p 1234.

    Commands from the GNU project can typically accept options either in the traditional short form and in a long form, where the option name is an entire word that can be abbreviated as long as the abbreviation is unique. For example, ls has a -F option to append a / to directory names and so forth. Gnu ls lets this be specified as --classify, or abbreviated as --cl. To avoid ambiguity and for backwards compatibility, old-style single-letter options use a single -, while long-form options use --.

    Finally some commands take options with long names introduced by a single -; the find command is an example of this.

    The only real solution is to read the man page for the specific command you’re running.

    A single dash can be followed by multiple single-character flags. A double dash is followed by a single, multi-character flag.

    in your case

    sudo docker run --rm -ti --net=example --name server ubuntu:14.04 bash
    

    flags:

    rm (multi-character)
    t  (single)
    i  (single)
    net (multi-character)
    name (multi-character)
    

    ,

    nc -lp 1234
    

    flags:

    l (single)
    p (single)
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.