Stateless Containers Are Easier to Live With

Why stateless containers are the better approach, compared to stateful applicatins.

A program is easier to operate when you can kill it.

If killing one container risks losing data, that container owns state. Once that happens, the instance becomes special. You have to care which container is running, where it runs, and what is stored inside it.

That makes everything harder.


A stateless container does one thing: run the application.

Persistent state lives somewhere else designed for persistence:

  • in a database
  • files in blob storage
  • sessions or caches in Redis
  • jobs in queue
  • secrets in a secret manager

Now the container can disappear any time.

This means that deployments can replace old containers instead of carefully modifying them. Scaling means more copies. Recovery means starting another copy. Moving to another machine means starting the same container somewhere else.

You stop managing individual instances, and you can let an orchestrator manage the containers automatically.


That is the magic of statelessness.


If you can destroy every application container and recreate them without losing anything important, you have a much easier system to operate.