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

  • Docker Compose to CoreOS
  • Can I access the host (OS X) filesystem from the boot2docker VM?
  • Vaultier is unusable for docker/ubuntu/debian (Python)
  • How can I make docker-compose build an image from a remote git repository?
  • Connect to docker-machine using docker-py (OSX)
  • How do I expose ports on Heroku with a Dockerfile?
  •  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.

  • How to check if application has started inside container
  • Pip install -e packages don't appear in Docker
  • Why am I getting ECONNREFUSED connecting to localhost MySQL from docker node app?
  • Docker + Nodejs + Private Repo + Private NPM Module - Access Problems
  • Docker - copy file from container to host
  • Kubernetes: Cannot deploy flask web app with apache and https
  • 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.