我正在尝试使用官方的mariadb docker图像以及php-fpm和nginx来运行我的Symfony 2应用程序。
我们的想法是将所有db文件保存在已安装的文件夹中。虽然在Mac OS上它工作得很好 - 在Windows机器上我每次MariaDB尝试启动时都会收到错误。奇怪的是,它实际上能够创建一些文件 - 我可以看到ibdata1文件,但它的大小是0字节。还有两个带有几KB数据的aria_log文件,这意味着mysql实际上可以在那里写入。
docker for windows 1.12.2 beta
。但也试过稳定的。这是我的docker-compose文件:
version: '2'
services:
db:
image: mariadb
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test
MYSQL_USER: root
MYSQL_PASSWORD: root
volumes:
- ./docker-runtime/mysql:/var/lib/mysql
php:
build: ./docker/php-fpm
volumes:
- ./:/var/www/symfony
- ./docker-runtime/logs/symfony:/var/www/symfony/app/logs
links:
- db
nginx:
build: ./docker/nginx
ports:
- "80:80"
links:
- php
volumes_from:
- php
volumes:
- ./docker-runtime/logs/nginx/:/var/log/nginx
以下是我做docker-compose up
时日志所说的内容:
db_1 | 2016-10-18 13:14:06 7f79eed7f7c0 InnoDB: Error: Write to file ./ibdata1 failed at offset 0.
db_1 | InnoDB: 1048576 bytes should have been written, only 0 were written.
db_1 | InnoDB: Operating system error number 22.
db_1 | InnoDB: Check that your OS and file system support files of this size.
db_1 | InnoDB: Check also that the disk is not full or a disk quota exceeded.
db_1 | InnoDB: Error number 22 means 'Invalid argument'.
db_1 | InnoDB: Some operating system error numbers are described at
db_1 | InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html
db_1 | 2016-10-18 13:14:06 140161674901440 [ERROR] InnoDB: Error in creating ./ibdata1: probably out of disk space
db_1 | 2016-10-18 13:14:06 140161674901440 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
db_1 | 2016-10-18 13:14:06 140161674901440 [ERROR] Plugin 'InnoDB' init function returned error.
db_1 | 2016-10-18 13:14:06 140161674901440 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
db_1 | 2016-10-18 13:14:06 140161674901440 [ERROR] Unknown/unsupported storage engine: InnoDB
db_1 | 2016-10-18 13:14:06 140161674901440 [ERROR] Aborting
我真的很感激关于这个问题的任何想法,因为我现在正在把我的头发拉出来
答案 0 :(得分:4)
可能您有权限问题。要丢弃更改docker-compose.yml以使用命名卷:
version: '2'
services:
db:
image: mariadb
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test
MYSQL_USER: root
MYSQL_PASSWORD: root
volumes:
- mysql:/var/lib/mysql
php:
build: ./docker/php-fpm
volumes:
- ./:/var/www/symfony
- ./docker-runtime/logs/symfony:/var/www/symfony/app/logs
links:
- db
nginx:
build: ./docker/nginx
ports:
- "80:80"
links:
- php
volumes_from:
- php
volumes:
- ./docker-runtime/logs/nginx/:/var/log/nginx
volumes:
mysql:
尝试查看mysql错误是否消失。
此致
答案 1 :(得分:1)
在启动MariaDB时(在Dockerfile的CMD
或docker-compose command:
中),您需要添加此选项:
--innodb-flush-method=fsync
在此处记录:https://github.com/docker-library/mariadb/issues/95
如果这样做没有帮助,请同时添加--innodb-use-native-aio=0
。
Windows或Mac OS X都不支持异步I / O:
https://dev.mysql.com/doc/refman/8.0/en/innodb-linux-native-aio.html