docker run
Container ManagementCreate and start a new container from an image
Options & Flags
Available options for this command
-dRun container in detached mode (background)
-p host:containerMap port(s) from host to container
--name NAMEAssign a name to the container
-v host:containerMount volume
-e KEY=VALUESet environment variable
--rmAutomatically remove container when it exits
Examples
Common usage examples
Run nginx in background, map port 80
docker run -d -p 80:80 nginxRun container with custom name
docker run --name myapp -d myimageRun Ubuntu interactively with bash
docker run -it ubuntu bashRelated Commands
You might also find these useful