# STOPPED (CannotStartContainerError: API error (500): devmapper: Thin pool has X free data blocks which is less than the minimum required X total data blocks)

- **ID:** `aws/ecs-task-stopped-cannotstartcontainererror`
- **Domain:** aws
- **Category:** resource_error
- **Error Code:** `CannotStartContainerError`
- **Verification:** ai_generated
- **Fix Rate:** 75%

## Root Cause

ECS task fails because the Docker storage driver (devicemapper) on the container instance has insufficient free data blocks in its thin pool, often due to disk space exhaustion or misconfigured Docker storage.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| ECS 1.62.0 | active | — | — |
| Docker 20.10.17 | active | — | — |
| Amazon Linux 2 | active | — | — |

## Workarounds

1. **Run `docker system prune -a --volumes` on the container instance to remove unused Docker objects and free thin pool space. Then restart the ECS task.** (85% success)
   ```
   Run `docker system prune -a --volumes` on the container instance to remove unused Docker objects and free thin pool space. Then restart the ECS task.
   ```
2. **Increase the Docker base device size by editing `/etc/docker/daemon.json` to set `{"storage-opts": ["dm.basesize=50G"]}` and restarting Docker service.** (70% success)
   ```
   Increase the Docker base device size by editing `/etc/docker/daemon.json` to set `{"storage-opts": ["dm.basesize=50G"]}` and restarting Docker service.
   ```

## Dead Ends

- **Manually restarting the ECS agent or the container instance without cleaning up unused images/containers.** — The underlying thin pool is still full; restarting does not free data blocks. (90% fail)
- **Increasing the ECS task memory limit without addressing Docker storage.** — The error is about disk storage blocks, not memory allocation. (95% fail)
