I’ve encountered this several times and usually just run the quick fix: Destroy the container and restart with a new one. But, in this case, I really don’t want to go through that trouble, so let’s go ahead and fix this.
What does it mean?
Some quick research reveals that this has to do with – you guessed it – input and output. It somehow fails the setup.
What else do we see?
The logs provide some more information, as seen below:
InnoDB: You can disable Linux Native AIO by setting innodb_use_native_aio = 0 in my.cnf
InnoDB: Cannot initialize AIO sub-system
Well, let’s create some config files and apply the setting above!
My current docker-compose.yml database service looks like this:
db:
container_name: ${NAME}-db
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
volumes:
- "./app/data/db:/var/lib/mysql"
In order to define our own config files, we’ll have to add a new volume, like below:
- "./app/conf/my.cnf:/etc/alternatives/my.cnf"
Combined, the service looks like this:
db:
container_name: ${NAME}-db
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
volumes:
- "./app/data/db:/var/lib/mysql"
- "./app/conf/my.cnf:/etc/alternatives/my.cnf"
Create a file called my.cnf
in the conf
directory and add the following content:
[mysqld]
innodb_use_native_aio = 0
Let’s see if that works by running docker-compose up
again.
It did!
After disabling native AIO, the mysql starts successfully. Problem solved!
Leave a Reply