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:
Disclaimer: I’m not a linux or docker expert. Kinda new to docker.
Today while doing local development on my mac I encountered an error and subsequently it seems the volume I was using is now erased?
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.