Skip to content

Persisting Container Data

Vishwas Parpattegar edited this page Oct 22, 2024 · 4 revisions

Data Persistence in Docker

Docker lets us run containers as isolated, immutable artifacts, shipping everything required to run them on any host with Docker installed. By default, Docker containers are ephemeral meaning any data stored in the container is lost once it's closed.

However, if you're running an application like a database in a container, you wouldn't want to start with an empty database each time. For these use-cases, Docker provides two primary methods of persisting data within a container.

Volume Mounts

Bind Mounts

Clone this wiki locally