✦ For everyone, free.

Practical knowledge for real and everyday life

Home

6.1.1 Container Creation

A focused guide to Container Creation, connecting core concepts with practical Docker and container operations.

Container creation is the step in a container's lifecycle where Docker allocates the resources needed to run an instance of an image — a writable layer, a network endpoint, configuration metadata — without yet starting the container's main process, distinct from actually running it.

Creating a Container Without Starting It

The docker create command produces a new container in a created (but not running) state, useful when configuration needs to be set up or inspected before the container's process actually begins.

docker create --name myapp-container myapp:1.0
docker ps -a

This newly created container appears in the full container listing, shown with a status indicating it has been created but not yet started.

What Happens During Creation

Creation establishes the container's writable layer (initially empty, layered on top of the image's read-only layers), sets up its network configuration, and records whatever configuration options were specified — but does not yet execute the image's startup command.

docker create --name myapp myapp:1.0
docker inspect myapp --format '{{.State.Status}}'

This reports the container's status as created, confirming the process has not yet started.

docker run Combines Creation and Starting

The more commonly used docker run command performs both creation and starting in a single step, which is why most everyday usage doesn't need to think about creation as a distinct phase at all.

docker run -d --name myapp myapp:1.0
Why Understanding Container Creation Matters

Recognizing creation as a distinct step from starting clarifies what docker create actually does, and helps explain certain commands and workflows (such as preparing several containers' configuration before starting any of them) that explicitly separate these two otherwise commonly combined steps.

Content in this section