Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker mariadb unable to start

Tags:

docker

mariadb

My MariaDB container doesn't start and I don't know why. This is my docker-compose.yml:

version:  '3.7'
services:
    mariadb:
        image: ${MARIADB_VERSION}
        restart: on-failure
        environment:
            MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
            MYSQL_DATABASE: ${MYSQL_DATABASE}
            MYSQL_USER: ${MYSQL_USER}
            MYSQL_PASSWORD: ${MYSQL_PASSWORD}
        ports:
            - ${PORTS_MARIADB}
        volumes:
            - './db/:/var/lib/mysql'
        user: 1000:1000

After this, I ran these commands:

docker-compose build
docker-compose up -d

But my MariaDB container doesn't want to start. There is the logs of the container:

2020-05-12 20:33:35+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.4.12+maria~bionic started.
2020-05-12 20:33:35+00:00 [Note] [Entrypoint]: Initializing database files
2020-05-12 20:33:36 0 [ERROR] InnoDB: The Auto-extending innodb_system data file './ibdata1' is of a different size 0 pages than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!
2020-05-12 20:33:36 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2020-05-12 20:33:36 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-05-12 20:33:36 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-05-12 20:33:36 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2020-05-12 20:33:36 0 [ERROR] Aborting

Installation of system tables failed!  Examine the logs in
/var/lib/mysql/ for more information.

The problem could be conflicting information in an external
my.cnf files. You can ignore these by doing:

    shell> /usr/bin/mysql_install_db --defaults-file=~/.my.cnf

You can also try to start the mysqld daemon with:

    shell> /usr/sbin/mysqld --skip-grant-tables --general-log &

and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:

    shell> /usr/bin/mysql -u root mysql
    mysql> show tables;

Try 'mysqld --help' if you have problems with paths.  Using
--general-log gives you a log in /var/lib/mysql/ that may be helpful.

The latest information about mysql_install_db is available at
https://mariadb.com/kb/en/installing-system-tables-mysql_install_db
You can find the latest source at https://downloads.mariadb.org and
the maria-discuss email list at https://launchpad.net/~maria-discuss

Please check all of the above before submitting a bug report
at http://mariadb.org/jira

Why and what can I do to resolve this ?

Best regards :)

like image 798
FindL Avatar asked Oct 19 '25 03:10

FindL


1 Answers

I think you use Docker Desktop on Windows? If it's the case, it's a known issue. You can't mount an host volume on mariadb on windows. For more details, you can check the github issue: https://github.com/docker-library/mariadb/issues/152

The workaround is to use a named volume manage by docker:

version:  '3.7'
services:
    mariadb:
        image: ${MARIADB_VERSION}
        restart: on-failure
        environment:
            MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
            MYSQL_DATABASE: ${MYSQL_DATABASE}
            MYSQL_USER: ${MYSQL_USER}
            MYSQL_PASSWORD: ${MYSQL_PASSWORD}
        ports:
            - ${PORTS_MARIADB}
        volumes:
            - mariadb-data:/var/lib/mysql
like image 76
jmaitrehenry Avatar answered Oct 20 '25 16:10

jmaitrehenry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!