[英]Docker mariadb unable to start
我的 MariaDB 容器无法启动,我不知道为什么。 这是我的 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
在此之后,我运行了这些命令:
docker-compose build
docker-compose up -d
但是我的 MariaDB 容器不想启动。 有容器的日志:
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
为什么以及我能做些什么来解决这个问题?
此致:)
我认为您在 Windows 上使用 Docker 桌面? 如果是这样,这是一个已知问题。 您不能在 windows 上的 mariadb 上安装主机卷。 有关更多详细信息,您可以查看 github 问题: https://github.com/docker-library/mariadb/issues/152
解决方法是使用由 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
删除用户:1000:1000并尝试
version: '3.7'
services:
mariadb:
image: mariadb:${MARIADB_VERSION}
restart: always
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'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.