docker run

Creates a new container from an image and starts it, in one step.

In more detail

docker run is docker create plus docker start. Common flags: --rm deletes the container when it exits, -d runs it in the background, --name gives it a name, -p publishes a port, -e sets an environment variable, -v mounts a volume, -m and --cpus set limits. Anything after the image name replaces the image default command.

Examples

docker run --rm alpine:3.20 echo hello
docker run -d --rm --name m01l01-broker --network m01l01-net redpandadata/redpanda:v25.2.6 redpanda start

Related terms

Taught in

References

Certification courses