docker run

Run a container

high risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
Safer / dry-run alternatives
docker run --rm --read-only --cap-drop ALL --security-opt no-new-privileges <image>Hardened run options
What it does

Creates and starts a container from an image.

Common flags
FlagMeaning
-dDetached
-pPublish port host:container
-vMount volume or host path⚠ Mounting / or the Docker socket gives host control.
--rmRemove container on exit
--privileged --privilegedFull host access⚠ Disables isolation.
-eEnvironment variable⚠ Visible in docker inspect.
--network hostHost networking⚠ Bypasses network isolation.
--userRun as user
Examples
docker run --rm -it alpine shThrowaway shell · explain & risk-check →
docker run -d --name web -p 8080:80 nginx:1.27Run nginx · explain & risk-check →
Related
docker docker exec
Open the full explainer →More in Docker & Containers

Reference text is hand-written and may be incomplete — check man docker for your version. Test destructive commands on a non-production system first.