Volume deleted somehow?

UPDATE:
Got this solved. Posting here for posterity. The issue was the custom “my.cnf” file that I added to my docker-compose.yml a while back. It was overwriting the default file located at “/etc/mysql/my.cnf” within the container. This was causing MySQL to not know where to save the data, thus breaking the volume mapping to my named volume. I just didn’t notice the change because my normal workflow was to stop, but not remove the containers.

The solution was to map in my custom mysql config to a different directory in the load path.

Original with problem:

db:
    image: mysql:5.6
    container_name: lemp_mysql
    volumes:
      - db-data:/var/lib/mysql
      - ./mysql/my.cnf:/etc/mysql/my.cnf:ro

Solution:

db:
    image: mysql:5.6
    container_name: lemp_mysql
    volumes:
      - db-data:/var/lib/mysql
      - ./mysql/my.cnf:/etc/mysql/conf.d/ZZ-myApp.cnf:ro

ORIGINAL POST

Disclaimer: I’m not a linux or docker expert. Kinda new to docker.

Summary:
Today while doing local development on my mac I encountered an error and subsequently it seems the volume I was using is now erased?

Details
So I had my containers running via “docker-compose up” run in a terminal. Sometimes I have to leave Docker land and start up MAMP to work on stuff, which I did and per usual I just do CTRL+C to get docker to shut down the containers. I do this all the time, and have never had any problems.

While today, I did that and it gave me an “ERROR: Aborting.” message when I hit CTRL+C. Whatever, so just typed out “docker-compose down”, did my work in MAMP, then when coming back to docker and doing “docker-compose up” the start-up was more verbose than normal and upon starting, I discovered all my database data that is mapped in from a volume is gone. I’m wondering if the data got deleted, or if there’s a way to recover it, or what. It’s not the end of the world in that I can just download a fresh copy of our production data, but if it erased the data and this is something I’m going to have to deal with periodically, that’s going to be pretty annoying.

Any insight into what happened and what I can do to prevent this in the future? Any help would be appreciated.

CLARIFICATION: If I do “docker volume ls” I see a volume with the right naming format “projectName_db-data”, however it’s seemingly either not getting mapped in correctly or it got overwritten and no longer has my previous data.

.
.

Docker Compose

version: '3.3'
services:
  nginx:
    image: evild/alpine-nginx:1.9.15-openssl
    container_name: lemp_nginx
    volumes:
      - ./app:/var/www/app/:ro
      - ./nginx/conf/nginx.conf:/etc/nginx/conf/nginx.conf:ro
      - ./nginx/conf.d:/etc/nginx/conf.d:ro
    ports:
      - 80:80
      - 443:443
    depends_on:
      - php
  php:
    image: joebubna/php
    container_name: lemp_php
    restart: always
    volumes:
      - ./app:/var/www/app:cached
    ports:
      - 9000:9000
  db:
    image: mysql:5.6
    container_name: lemp_mysql
    volumes:
      - db-data:/var/lib/mysql
      - ./mysql/my.cnf:/etc/mysql/conf.d/ZZ-ifuel.cnf:ro
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: user
      MYSQL_PASSWORD: password
      MYSQL_DATABASE: cora
    ports:
      - 3306:3306
volumes:
  db-data: