MariaDB / mariadb-docker

Docker Official Image packaging for MariaDB
https://mariadb.org
GNU General Public License v2.0
770 stars 438 forks source link

docker compose fail. unknown/unsupported storage engine: InnoDB #267

Closed samayo closed 4 years ago

samayo commented 4 years ago

I have a docker-compose file where I run mariadb, nginx, php. But Mariadb keeps restarting every second for some reason:

$ docker ps
CONTAINER ID        IMAGE        COMMAND                CREATED        STATUS        PORTS                NAMES

a8dd9dfc0865        my_db        "docker-entrypoint.s…"   19 minutes ago      Restarting (1) 6 seconds ago                    foo-db

If I check the logs, I see this error:

my-db | 2019-10-25  6:32:19 0 [ERROR] InnoDB: Cannot read first page of './ibdata1' I/O error
my-db | 2019-10-25  6:32:19 0 [ERROR] InnoDB: Plugin initialization aborted with error I/O error
my-db | 2019-10-25  6:32:20 0 [Note] InnoDB: Starting shutdown...
my-db | 2019-10-25  6:32:20 0 [ERROR] Plugin 'InnoDB' init function returned error.
my-db | 2019-10-25  6:32:20 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
my-db | 2019-10-25  6:32:20 0 [Note] Plugin 'FEEDBACK' is disabled.
my-db | 2019-10-25  6:32:20 0 [ERROR] Unknown/unsupported storage engine: InnoDB
my-db | 2019-10-25  6:32:20 0 [ERROR] Aborting

and here is my docker-compose file related to mariadb

version: '3'

services:
    db:
      container_name: ${APP_NAME}-db
      build:
        context: ./docker/mariadb
      volumes:
          - ./docker/mariadb/scripts:/docker-entrypoint-initdb.d
          - ./.data:/var/lib/mysql
          - ./docker/logs/mariadb:/var/log/mysql
      environment:
          MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
          MYSQL_DATABASE: ${MYSQL_DATABASE}
          MYSQL_USER: ${MYSQL_USER}
          MYSQL_PASSWORD: ${MYSQL_PASSWORD}
          MYSQL_ALLOW_EMPTY_PASSWORD: ${MYSQL_ALLOW_EMPTY_PASSWORD}
      ports:
          - '${MYSQL_PORT:-3306}:3306'
      command:
          ['--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']

      networks:
        - default
      restart: always
ghost commented 4 years ago

We saw that, too after we ran into https://github.com/docker-library/mariadb/issues/262 Also see https://stackoverflow.com/questions/58542447

wglambert commented 4 years ago

Cannot read first page of './ibdata1' I/O error this is the parent error

Issues with that exact phrase: https://github.com/docker-library/mysql/issues/370#issuecomment-456266929

Either corrupt or your drive is going bad (which is usually when I start to see IO errors like that).

https://github.com/goharbor/harbor/issues/4100#issuecomment-360861557

I was able to fix this by running mysql_upgrade on the database running in a helper container

samayo commented 4 years ago

I can't run mysql_upgrade because I can access mysql in the first place

wglambert commented 4 years ago

Then I would recommend asking the Docker Community Forums, Docker Community Slack, or Stack Overflow. Since these repos aren't really a user-help forum

Going to close since this isn't an issue with the image

renanfenrich commented 3 years ago

Edit (by @grooverdan):

I'm removing this "answer"/"solution" because far too many people have lost data due to removing ib_logfile0. New versions won't start with it missing. Its unclear what the original problem was, but people jumping to this solution will just end up with users loosing data where it may have been recoverable.

The important take away is " unknown/unsupported storage engine: InnoDB" is a very broad range of things that could cause it, most are recoverable if you look at the previous information provided in the log file. If you don't see a mapping, per the previous comment, do ask.