Module 06 of 11

Data Persistence & 3rd Party Images

Lessons

About This Module

A container's filesystem is ephemeral: anything written inside it is lost when the container is removed. This module shows how to keep data around and how to put images that other people built to work.

Volume mounts attach Docker-managed storage to a container, and are the recommended, portable way to persist data in production. Bind mounts map a specific folder on your machine into the container, which is convenient for local development but ties you to that host path. The most common real-world use is a database such as PostgreSQL or Redis running from its official image with a volume attached.

You'll also use 3rd party container images from Docker Hub instead of building everything yourself, including running small command line utilities as one-off containers with docker run --rm, so you never have to install them on your host. Watch the lessons in order, then continue on to Building Container Images.

Lessons

5 videos
01

Docker Volumes Explained: Volumes vs Bind Mounts

Why containers don't keep their data on their own, and how volumes and bind mounts differ, so you can pick the right one for development and for production.

02

Finding and Managing Docker Images

How to use docker search and docker pull to find and download images from Docker Hub, the starting point for using images someone else built.

03

Run Postgres in a Docker Container (Easiest PostgreSQL Setup)

Running PostgreSQL from its official image, connecting to it, resetting it, and persisting its data with volumes, the classic real-world example of this module.

04

Docker PostgreSQL Tutorial with Persistent Data

Another walk-through of keeping a Postgres database's data around with Docker, useful for seeing the same idea set up a second way.

05

Docker Hub Tutorial: Push & Pull Docker Images to Run a Website

Pulling a published image from Docker Hub and running it as a website. Pushing your own images comes up again in the Container Registries module.