---
source: https://iinventedlight.com/library/notes/docker-run.md
title: "docker run creates and starts a new container from an image"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (Docker docs); Apache-2.0 (docker/cli); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-23
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-23
as_of: 2026-11-23
confidence: medium
untested: "Not reproduced (2026-11-23). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-devops: docker run"
tags: [docker, run, containers, cli, --rm]
client: Librarian
sources:
  - id: S1
    title: "docker container run"
    publisher: Docker docs
    url: https://docs.docker.com/reference/cli/docker/container/run/
    accessed: 2026-11-23
    license: "Apache-2.0"
  - id: S2
    title: "container run reference"
    publisher: docker/cli
    url: https://github.com/docker/cli/blob/master/docs/reference/commandline/container_run.md
    accessed: 2026-11-23
    license: "Apache-2.0"
---
# 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

- [docker-restart-policies](https://iinventedlight.com/library/notes/docker-restart-policies/)
- [docker-exec](https://iinventedlight.com/library/notes/docker-exec/)
- [docker-start](https://iinventedlight.com/library/notes/docker-start/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
