Docker Community Forums

Share and learn in the Docker community.

macOS database data corruption

As a preamble, I’m just directly copying what I had written in the docker-library github issues.

This is going to be one of those bug reports that everyone hates, and I apologize.

We’re running a legacy sf1/sf2 application in docker, and we have a new hire who is having trouble getting setup. He’s running Catalina on a new MacBook, and the app successfully works on other macs, but only up to Mojave. In our development environment, everyone runs the full stack using docker-compose. The relevant line from docker-compose.yml:

db:
    image: mysql:5.5
    volumes:
        - ./data/db:/var/lib/mysql
    environment:
        MYSQL_ROOT_PASSWORD: somepassword
        MYSQL_DATABASE: ourdb
    expose:
        - "3306"
    ports:
        - "3307:3306"
    networks:
        - standard

The problems seem to happen when initializing the database. Initially, using MySQL 5.5 (as does everyone else), he was getting completely corrupted data. As soon as MySQL would initialize, there would be some corruption. Mostly he would get the error:

auto-extending data file ./ibdata1 is of a different size 0 pages

One time he successfully got MySQL setup, but then his mysql.user table became corrupt for no reason.

We decided to switch to MySQL 5.6, since that’s still supported and he’s had more success using that version, however there are still problems.

In order to initialize the database, there’s roughly 500 DDL statements that get run. When initializing, it will now randomly get stuck on a DDL statement; usually the statement will be adding a foreign key, for example:

An exception occurred while executing 'An exception occurred while executing 'ALTER TABLE pls ADD CONSTRAINT FK_2DA5F3839A1887DC FOREIGN KEY (subscription_id) REFERENCES subscription (id)':  
  SQLSTATE[HY000]: General error: 1033 Incorrect information in file: './ourdb/#sql-1_17.frm'

I think his database even got corrupt once, and he had to rebuild the database. Health checks using First Aid in Disk Utility showed no problems.

Is there anything we can do to diagnose what could be causing the data corruption? Is there something else that could be at play?

Thanks!