The most detailed free FDE + DevOps library: 140+ lessons, 70+ labs and 80 long-form articles, in English and Turkish. Start learning →

Container volumes and networks: where data really lives

Updated

Colorful shipping containers seen from above at a port

Data loss in containers is a mount mistake: named volumes for state, read-only mounts by default, explicit networks.

Containers are ephemeral; the data must not be. Every container data-loss story ends at a mount that nobody drew on a diagram: state in the writable layer, a bind mount to a laptop path, or two services sharing a network nobody named.

State outlives the container

Named volumes hold state. Databases, uploads and queues live in named volumes with a backup story. The writable container layer holds nothing you would miss.

Mount read-only by default. Config, fixtures and shared content mount read-only; only the paths that must change stay writable. An attacker or a bug then finds most doors locked.

Name the networks. Each purpose gets its network, and each service joins only what it needs. Debugging who talks to what becomes a lookup instead of an investigation.

Worked example: a fictional lost upload

The context below is fictional. Fictional app ParcelTrack (fictional) stores uploads in the container layer on one host. A routine image update wipes a week of customer files; there is no backup because nobody classified uploads as state.

The rebuild moves uploads to a named volume with nightly archives, mounts config read-only, and splits frontend from data traffic on two named networks. Next update: new image, same data, zero loss.

Checklist: data that survives updates

  1. Every stateful path named as a volume with a backup.
  2. Non-write mounts read-only.
  3. Networks named per purpose, services minimally joined.
  4. An update test proves data survives a new image.

Straight answers

Frequently asked questions

Bind mount or named volume?

Named volumes for production data, bind mounts for development code. Bind mounts tie the container to one machine layout.

Why read-only mounts?

Most mounts never need writes. Read-only is a free guard against bugs and break-ins writing where they should only read.

One network or many?

Explicit networks per purpose: frontend, backend, data. The default tangle hides which service talks to what.

Bu sayfanın Türkçesi

Turn reading into a credential

This post is a free field note. Exams run at dated sittings in 15-seat classes; one price covers one attempt. All lessons are free.