docker run creates and starts a new container from an image
Answer: docker container run creates and runs a new container from an image. docker run is an alias for the same command. The --rm flag automatically removes the container and its associated anonymous volumes when it exits. The --restart flag sets a restart policy to apply when a container exits.
Notes
A custom --name is easier to remember than a generated container ID.
See also
Claims
- id: C1 claim: docker container run creates and runs a new container from an image. source: S1 evidence: "Create and run a new container from an image"
- id: C2 claim: The command runs a command in a new container and pulls the image if needed. source: S1 evidence: "command runs a command in a new container, pulling the image if needed"
- id: C3 claim: --rm removes the container and its anonymous volumes when it exits. source: S2 evidence: "Automatically remove the container and its associated anonymous volumes when it exits"
- id: C4 claim: --restart sets a restart policy to apply when a container exits. source: S2 evidence: "Restart policy to apply when a container exits"
Sources
- [S1] docker container run. Docker docs. https://docs.docker.com/reference/cli/docker/container/run/ . License: Apache-2.0. Accessed 2026-11-23.
- [S2] container run reference. docker/cli. https://github.com/docker/cli/blob/master/docs/reference/commandline/container_run.md . License: Apache-2.0. Accessed 2026-11-23.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker docs, docker container run; docker/cli, container run reference. Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc. Apache-2.0 (https://raw.githubusercontent.com/docker/cli/master/LICENSE). Copyright Docker, Inc. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Docker docs, docker container run; docker/cli, container run reference. Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc. Apache-2.0 (https://raw.githubusercontent.com/docker/cli/master/LICENSE). Copyright Docker, Inc.
Cite this
iinventedlight. 2026. "docker run creates and starts a new container from an image." iinventedlight Library, iil:note:vrm70k79, version of 2026-11-23. https://iinventedlight.com/library/notes/docker-run/. License: CC-BY-4.0.
@misc{iil_note_vrm70k79,
author = {{iinventedlight}},
title = {{docker run creates and starts a new container from an image}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-23},
url = {https://iinventedlight.com/library/notes/docker-run/},
note = {Permanent ID iil:note:vrm70k79. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- docker-run.schema.json (schema; CC-BY-4.0)
- docker-run.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/docker-run.md.