docker/run

Run Container

Create and start a new container

container
lifecycle

Command

docker run

Explanation

This command creates and starts a container from an image. The -d flag runs it in detached mode (background), while -it allocates a pseudo-TTY and keeps STDIN open for interaction.

Examples

Run Nginx in detached mode

docker run -d nginx

Run interactive Ubuntu container

docker run -it ubuntu bash