Docker Tutorial #6: Docker Volumes and Networking Explained
Containers are ephemeral. When a container stops, all data written inside it disappears. That is fine for stateless apps, but databases and file storage need to persist data. Docker solves this with volumes. And Docker solves container communication with networks. In this tutorial, you will learn both. The Ephemeral Container Problem When you run a PostgreSQL container and insert some rows, that data lives in the container’s writable layer. Stop the container, remove it, and start a new one — the data is gone. ...