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 


  • What special precautions must I make for docker apps running as pid 1?
  • Start a dependency unit in CoreOS
  • Record Sound on Ubuntu Docker Image
  • Docker: Strider CD dashboard assets broken on installation
  • How to bind the VM docker-machine creates to OSX IP address?
  • Remove local Docker images on macOS
  •  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.

  • Stop recently started container in docker?
  • how to install libcontainer docker in place of lxc-docker
  • Adjust OOM killer for subprocess in Docker container
  • how can only package up dockerfile+jar like `distTar` not build image
  • Create multiple Docker machines at once with docker-machine
  • Dockerized Angular 4 and Django is compiled successfully but localhost:4200 is not working
  • 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


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


    nc -lp 1234


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