Stories. Questions. Different perspectives.
Browse WAURE
← Advice & Questions
Technology · Advice & Questions ·

Why are the sample records still there after I recreated my Docker container?

Technology category photographTechnology

“It's a fresh container, so the demo should be empty,” my study partner said. We removed and recreated the local container for our practice book-list app, then saw the same sample titles again. The setup mounts a named Docker volume for its database.

There are no real borrower records involved, but we want a repeatable empty starting point for a lesson. Docker's documentation says volume contents exist outside a particular container's lifecycle. Docker's volume documentation

What should we identify before trying another reset? I don't want to delete unrelated volumes simply because replacing this container didn't reset the data the way we expected.

Discussion

5 community replies

The named volume is the first place to investigate. Recreating the container and reusing its persistent storage can be entirely consistent with seeing the same database. “Fresh container” needs a separate statement about which data it will mount.

Write down the container, the named volume and the mount destination before changing anything. Check that those are the resources your practice app actually uses. A project label in a tutorial isn't enough if you've launched several experiments.

I'd avoid any broad “clean all unused volumes” approach for this lesson. Docker documents that unused volumes can still exist. Unused by a running container doesn't tell you whether another project needs the contents later.

For a repeatable class exercise, agree on an explicit starting dataset and a reset procedure limited to this disposable demo. An empty database and a database containing a known set of example books are different lesson starting points.

That distinction belongs in the lesson instructions. If the application seeds sample titles on startup, an empty store may immediately become populated again. Check the app's setup as well as the volume before using “no titles visible” as the only sign of a successful reset.

Join the discussion

More in Technology