Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dashes in Docker commands

Tags:

docker

When running docker commands we use options like --rm -it -p. The question is why in some cases there are two dashes "--rm", and in other cases just one dash "-p"?

like image 796
Alex Dvoretskiy Avatar asked Sep 03 '25 03:09

Alex Dvoretskiy


1 Answers

This is a standard Unix/Linux syntax, not specific to docker. One dash is used for single letter flags. Two dashes for an option that is more than one letter. You can merge together multiple single letter options that don't take arguments, e.g. -i and -t can be merged into -it. You can run docker --help to see all the options, some of which have both a long and short format.

like image 106
BMitch Avatar answered Sep 06 '25 01:09

BMitch