Sign in
GUIDE 11 / Infrastructure

Where does your data live?Let the app change. Keep the records.

Understand databases, container storage, volumes and data lifecycles through a visual write-and-replace model.

THE SHORT VERSION

A database engine and its stored data are different things.

A volume can outlive a container, but not every storage failure.

Persistence, replication and backups solve different problems.

01 / Persistent data

The software is not the information it holds.

A database engine is software that organizes and retrieves information. Your customer records are data managed by that software. Replacing an application or database container should not accidentally replace the only copy of those records.

Picture a small shop recording its first hundred orders. Its web application can be rebuilt many times, but those orders must remain. Start by identifying every durable piece of the project: database files, customer uploads and generated documents may each need a different storage arrangement.

02 / Persistent data

Follow a record beyond the container.

A container’s writable layer belongs to that container. A mounted volume provides storage outside that disposable layer and can remain when the container is removed. A replacement container must attach the intended storage at the path expected by its software.

In the model below, the order is written to a persistent volume. Replacing the application process leaves that storage attached. The final state shows why this is not a backup: a destructive change to the live data can still affect the stored record. Persistence is a lifecycle property, not a recovery guarantee.

Reference: Docker: volumes and their lifecycle
INTERACTIVE EXPLAINERThe process changes. Follow the stored order.
The process changes. Follow the stored order.
Application v1Running process
PERSISTENT VOLUMEOrder #104 stored

The order is stored outside the application container’s disposable layer.

Application v2New process / same volume
PERSISTENT VOLUMEOrder #104 stored

The replacement process uses the same intended data store. Persistence allows the record to survive this container replacement.

Application v2Running process
PERSISTENT VOLUMEOrder #104 removed

Deleting the live record changes the persistent data too. A separate recoverable backup is needed to recover an earlier state.

Conceptual example · explore each state
03 / Persistent data

Choose the database around the information.

Some applications model related records in tables; others organize documents, key-value entries or other structures. The important questions are about the work: which queries matter, what must change together, how consistency is handled and how the data will be operated.

You do not need to choose an engine because it appeared in a demo. The shop should consider how orders, inventory and payments relate, then use an engine and schema suited to those needs. Each engine also has its own configuration, upgrade and recovery procedures.

Choose the database around the information.
PartPurposeExample question
Database engineOrganize and query informationWhich model fits the application?
Persistent storageKeep files beyond a processWhere do the durable bytes live?
ReplicaMaintain another working copyWhat failures can it tolerate?
BackupKeep a recoverable earlier stateCan we restore after bad changes?
04 / Persistent data

A named volume still lives somewhere.

Giving a volume a stable name makes its purpose easier to track, but it does not describe its physical protection. A local disk, a network storage system and a managed database all have different failure boundaries. Know what happens if a host or storage device becomes unavailable.

For the shop, write down the storage location and who can delete it. Track capacity and growth before the disk fills. If the workload moves between hosts, confirm how its data becomes available at the new destination; moving a container does not automatically move its files.

Reference: Docker: volumes and their lifecycle
05 / Persistent data

Treat data changes as releases of their own.

A new application version may need a schema migration. That migration can affect whether an older version still understands the data. Review application compatibility, expected migration time and recovery together before changing a live database.

Use the backup and restore tools appropriate to the engine. For example, PostgreSQL distinguishes logical dumps, filesystem-level backups and continuous archiving. Other engines have their own mechanisms. Test a restore in an isolated environment and verify meaningful records, rather than treating a completed file copy as proof of recovery.

Reference: PostgreSQL: backup approaches
CLEAR UP THE DETAILS

Common questions.

Will restarting a container always delete its data?

Not necessarily. Restarting an existing container differs from removing it. Durable data should still use a deliberate storage arrangement rather than depending on a disposable layer.

Is a persistent volume a backup?

No. It can survive container replacement while still being affected by deletion, corruption or storage failure.

Can I use a database other than PostgreSQL?

Yes. Choose a suitable supported engine and configure its own runtime, data paths, credentials and backup process.

WHERE DOCKOCK FITS

Connect the concept to your work.

DOCKOCK places storage alongside the services that depend on it, helping you review application changes without losing sight of persistent data.

Explore persistent data in DOCKOCK

Keep learning from the source.

Further reading from the teams and documentation behind these technologies.

Docker: volumes and their lifecyclePostgreSQL: backup approaches
CONTINUE EXPLORING

Can you get back to working?

Build a recovery plan around the data and service you actually need back.

Read the next guide