DockerContainers

docker run

Creates and starts a new container from an image.

Syntax

docker run [-d] [-p <host>:<container>] <image>

Examples

Run detached, mapping port 3000

docker run -d -p 3000:3000 myapp:latest

Run interactively with a shell

docker run -it ubuntu:24.04 bash

Related commands