I am trying to use official mariadb docker image along with the php-fpm and nginx to run my Symfony 2 app.
The idea is to keep all the db files on a mounted folder. While on Mac OS it works just fine - on the Windows machine I am getting an error every time MariaDB attempts to start. The weird part is that it's actually able to create some files - I can see the ibdata1 file but the size of it is 0 bytes. There are also two aria_log files with few KBs of data which means that mysql is actually able to write there.
docker for windows 1.12.2 beta
. But tried the stable one too.Here is my docker-compose file:
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
And here is what the log say when I do 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
I would really appreciate any ideas on this issue as I'm currently at the point of pulling my hair out
Probably you have a permission problem. To discard change your docker-compose.yml to use named volumes:
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:
Try and see if the mysql error goes away.
Regards
You need to add this option when starting MariaDB (in Dockerfile's CMD
or docker-compose command:
):
--innodb-flush-method=fsync
It's documented here: https://github.com/docker-library/mariadb/issues/95
If it does not help, also add --innodb-use-native-aio=0
.
Asynchronous I/O are not supported on Windows nor Mac OS X:
https://dev.mysql.com/doc/refman/8.0/en/innodb-linux-native-aio.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With