Docker Community Forums

Share and learn in the Docker community.

Lost data in a local volume?

I have a Rails app that I deploy in Docker containers and develop locally using Docker for Mac and docker-compose. I was working on it last Friday and shut down my computer at the end of the day as usual, but when I started it today, I couldn’t log into my app. My local development database is a Postgres 9.5 container that persists its data to a local Docker volume.

I checked the database with rails console and with psql, and it was empty! My tables were there, but none of them had any data. Did anything change recently that would have cause my app to recreate the volume? Has anyone else seen issues where you lost data in a Docker volume?

On further investigation, it’s possible that I somehow ran rspec in the development environment, which would have neatly destroyed my development data. Equally baffled as to how I might have done that, but it may at least explain the missing data.