---
title: "Demystifying Docker Container Lifecycle States: Created, Running, Paused, Exited, and Dead"
date: "2026-11-17T11:00:00+07:00"
description: "Explore the complete container state transition graph from creation to removal and how kernel primitives govern each state."
author: "AI Assistant"
image: "https://blog.redlinesoft.net/images/post/container-lifecycle-states-explained.jpg"
alt: "State machine diagram of Docker container lifecycle transitions"
tags: ['docker', 'containers', 'architecture', 'devops']
---

A Docker container is not a persistent virtual machine, but a specialized, isolated host process wrapped in Linux namespaces, control groups (cgroups), and union storage layers.

During its existence, a container transitions through several distinct **Lifecycle States**. Understanding these states and their triggering CLI commands helps you manage applications, construct self-healing orchestrations, and troubleshoot container states effectively.

In this article, we will examine the complete container state machine graph and explain the mechanics governing each state.

---

## The Container Lifecycle State Machine

A container can exist in one of seven primary states maintained by containerd and the Docker daemon:

```text
               +---------------+
               |    Created    |
               +-------+-------+
                       |
                  docker start
                       |
                       v
    +------------------+------------------+
    |                                     |
    |  docker pause        docker stop    |
    v                       v             |
+---+----+              +---+----+        v
| Paused |              | Exited |    +-------+
+---+----+              +---+----+    | Dead  |
    |                       |         +-------+
 docker unpause        docker start
    |                       |
    v                       v
+---+-----------------------+----+
|            Running             |
+--------------------------------+
```

---

## 1. Created State (`created`)

- **Trigger**: `docker create <image>`
- **Description**: The Docker daemon prepares the container data structures:
  - Allocates a container ID and name.
  - Prepares the read-write container image storage layer (Overlay2).
  - Validates network drivers and host configurations.
- **Kernel State**: No active host process or namespaces are executing yet. Zero CPU or memory is consumed by execution.

---

## 2. Running State (`running`)

- **Trigger**: `docker run` or `docker start <container>`
- **Description**: The container's primary process (`PID 1`) is executing inside isolated Linux namespaces (PID, NET, MNT, IPC, UTS, USER).
- **Kernel State**: Cgroups enforce CPU, memory, and I/O resource limits. Port forwarding rules are active in iptables.
- **Commands Available**: You can interact via `docker exec`, `docker attach`, `docker logs`, and `docker stats`.

---

## 3. Paused State (`paused`)

- **Trigger**: `docker pause <container>`
- **Description**: Process execution inside the container is suspended instantly.
- **Kernel State**: Uses the Linux kernel **cgroup freezer subsystem**. All processes inside the container are frozen in place. The memory footprint remains in RAM, but CPU usage drops to 0%.
- **Resume**: `docker unpause <container>` resumes execution seamlessly without state loss.

---

## 4. Exited State (`exited`)

- **Trigger**: Primary process (`PID 1`) completes, crashes, or is stopped via `docker stop` / `docker kill`.
- **Description**: The main container process has terminated.
- **Kernel State**: Namespaces and PID execution cease. However, the container's file modifications in its writable layer, exit code, volume attachments, and network configurations are preserved on disk until explicitly removed.
- **Restarting**: Can be restarted back into the `running` state using `docker start`.

---

## 5. Restarting State (`restarting`)

- **Trigger**: Restart policy activation (`--restart always`, `on-failure`, `unless-stopped`).
- **Description**: A temporary state while the Docker daemon is attempting to restart a failed container process after a crash.

---

## 6. Dead State (`dead`)

- **Trigger**: Unrecoverable error during removal (e.g., resources held locked by the host kernel or driver failures during `docker rm -f`).
- **Description**: A terminal state where a container is partially destroyed but cannot be completely cleaned up by the daemon. Requires daemon restart or manual filesystem cleanup.

---

## State Transition Summary Table

| From State | To State | Trigger Command | Signal / Action |
| :--- | :--- | :--- | :--- |
| *None* | `created` | `docker create` | Prepare storage & metadata |
| `created` | `running` | `docker start` | Spawn PID 1 in namespaces |
| `running` | `paused` | `docker pause` | Freeze processes via cgroup freezer |
| `paused` | `running` | `docker unpause` | Thaw frozen processes |
| `running` | `exited` | `docker stop` | Send `SIGTERM` → `SIGKILL` |
| `running` | `exited` | `docker kill` | Direct `SIGKILL` |
| `exited` | `running` | `docker start` | Re-exec PID 1 |
| `exited` | *Removed* | `docker rm` | Delete writable layer & metadata |

---

## Summary

Containers cycle through well-defined lifecycle states: `created`, `running`, `paused`, `exited`, `restarting`, and `dead`. Understanding these transitions ensures better resource allocation, clean container removal, and proper orchestrator integration.

**Takeaway:** Remember that stopping a container moves it to `exited`, keeping its writable filesystem intact until you execute `docker rm`.

## Sources

- [Docker Docs: Get started](https://docs.docker.com/get-started/)
- [Docker CLI Reference: docker container](https://docs.docker.com/reference/cli/docker/container/)
