Skip to content

On OSX with volumes : InnoDB : Error 22 with aio_write #371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vmonteco opened this issue Feb 10, 2018 · 2 comments
Closed

On OSX with volumes : InnoDB : Error 22 with aio_write #371

vmonteco opened this issue Feb 10, 2018 · 2 comments

Comments

@vmonteco
Copy link

vmonteco commented Feb 10, 2018

Hello,

Here is what I get when I try to run :

docker run -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=dbname -d -v /path/to/vol:/var/lib/mysql  -p 32775:3306 mysql
Initializing database
2018-02-10T23:43:26.434351Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-02-10T23:43:26.438783Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2018-02-10T23:43:27.727838Z 0 [ERROR] InnoDB: Operating system error number 22 in a file operation.
2018-02-10T23:43:27.728063Z 0 [ERROR] InnoDB: Error number 22 means 'Invalid argument'
2018-02-10T23:43:27.728141Z 0 [ERROR] InnoDB: File ./ib_logfile101: 'aio write' returned OS error 122. Cannot continue operation

The only workaround I found was to build an other image from mysql with this dockerfile :


FROM mysql

RUN usermod -u 1000 mysql && echo "innodb_use_native_aio=0" >> /etc/mysql/conf.d/docker.cnf

But I'd like to be able to directly launch a mysql container from command line.

Is there a solution/workaround to this problem?

[EDIT] : It looks like the problem occurs when I try to mount a directory that is shared with the OSX host from my docker-machine as a volume.

@yosifkit
Copy link
Member

Yeah, we often see failure when using databases on VM/Host shared file systems.

You can specify the user id via --user to docker (#161) and you can pass almost any my.cnf value as a flag to the container.

$ docker run --user 1000:50 -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=dbname -d -v /path/to/vol:/var/lib/mysql  -p 32775:3306 mysql --innodb-use-native-aio=0

You could also just use a named volume and not have to worry about filesystem compatibility issues.

@vmonteco
Copy link
Author

It seems to work!
I actually wasn't aware that you coult pass custom uid:gid with --user.

Thank you for this anwer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants