Commands.app

docker run

Container Management

Create and start a new container from an image

Options & Flags
Available options for this command
-d

Run container in detached mode (background)

-p host:container

Map port(s) from host to container

--name NAME

Assign a name to the container

-v host:container

Mount volume

-e KEY=VALUE

Set environment variable

--rm

Automatically remove container when it exits

Examples
Common usage examples

Run nginx in background, map port 80

docker run -d -p 80:80 nginx

Run container with custom name

docker run --name myapp -d myimage

Run Ubuntu interactively with bash

docker run -it ubuntu bash
Related Commands
You might also find these useful