docker-compose mysql aio写错误W10

时间:2018-01-23 11:22:31

标签: mysql docker docker-compose

我想使用docker-compose在W10上创建mysql docker容器。这是我的docker-compose.yml:

database:
  image: mysql:5.5
  ports:
   - "3306:3306"
  environment:
     - MYSQL_ROOT_PASSWORD=pass
     - MYSQL_DATABASE=db
     - MYSQL_USER=user
     - MYSQL_PASSWORD=pass
  volumes:
     - ./data:/var/lib/mysql

当我执行docker-compose up database时,我得到以下输出:

Creating mysql_database_1 ...
Creating mysql_database_1 ... done
Attaching to mysql_database_1
database_1  | Initializing database
database_1  | 180123 11:11:29 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
database_1  | 180123 11:11:29 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.59) starting as process 64 ...
database_1  | 180123 11:11:30 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
database_1  | 180123 11:11:30 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.59) starting as process 70 ...
database_1  |
database_1  | PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
database_1  | To do so, start the server, then issue the following commands:
database_1  |
database_1  | /usr/local/mysql/bin/mysqladmin -u root password 'new-password'
database_1  | /usr/local/mysql/bin/mysqladmin -u root -h  password 'new-password'
database_1  |
database_1  | Alternatively you can run:
database_1  | /usr/local/mysql/bin/mysql_secure_installation
database_1  |
database_1  | which will also give you the option of removing the test
database_1  | databases and anonymous user created by default.  This is
database_1  | strongly recommended for production servers.
database_1  |
database_1  | See the manual for more instructions.
database_1  |
database_1  | Please report any problems at http://bugs.mysql.com/
database_1  |
database_1  | Database initialized
database_1  | MySQL init process in progress...
database_1  | 180123 11:11:31 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
database_1  | 180123 11:11:31 [Note] mysqld (mysqld 5.5.59) starting as process 80 ...
database_1  | 180123 11:11:31 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
database_1  | 180123 11:11:31 [Note] Plugin 'FEDERATED' is disabled.
database_1  | 180123 11:11:31 InnoDB: The InnoDB memory heap is disabled
database_1  | 180123 11:11:31 InnoDB: Mutexes and rw_locks use GCC atomic builtins
database_1  | 180123 11:11:31 InnoDB: Compressed tables use zlib 1.2.3
database_1  | 180123 11:11:31 InnoDB: Using Linux native AIO
database_1  | 180123 11:11:31 InnoDB: Initializing buffer pool, size = 128.0M
database_1  | 180123 11:11:31 InnoDB: Completed initialization of buffer pool
database_1  | InnoDB: The first specified data file ./ibdata1 did not exist:
database_1  | InnoDB: a new database to be created!
database_1  | 180123 11:11:31  InnoDB: Setting file ./ibdata1 size to 10 MB
database_1  | InnoDB: Database physically writes the file full: wait...
database_1  | 180123 11:11:31  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
database_1  | InnoDB: Setting log file ./ib_logfile0 size to 5 MB
database_1  | InnoDB: Database physically writes the file full: wait...
database_1  | 180123 11:11:31  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
database_1  | InnoDB: Setting log file ./ib_logfile1 size to 5 MB
database_1  | InnoDB: Database physically writes the file full: wait...
database_1  | 180123 11:11:31  InnoDB: Operating system error number 22 in a file operation.
database_1  | InnoDB: Error number 22 means 'Invalid argument'.
database_1  | InnoDB: Some operating system error numbers are described at
database_1  | InnoDB: http://dev.mysql.com/doc/refman/5.5/en/operating-system-error-codes.html
database_1  | InnoDB: File name ./ib_logfile0
database_1  | InnoDB: File operation call: 'aio write'.
database_1  | InnoDB: Cannot continue operation.
database_1  | MySQL init process in progress...

我认为卷存在问题 - InnoDB: File operation call: 'aio write'.我发现一个建议是设置innodb_use_native_aio = 0但是在部分环境中将其添加到docker-compose.yml并没有帮助

我在windows10主页上使用docker toolbox安装Docker version 17.07.0-ce, build 8784753docker-compose version 1.15.0, build e12f3b94

你知道如何解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

为我工作!但是您应该在Dockerfile中添加docker-compose.yml配置,而不是FROM mysql:5.5 EXPOSE 3306 RUN echo "innodb_use_native_aio=0" >> /etc/mysql/my.cnf 文件。

这是适用于我的解决方案:

  

Dockerfile MySQL的

mysql:
      build: 
        context: .
        dockerfile: Dockerfile-mysql
      environment:
        - MYSQL_ROOT_PASSWORD=pass
        - MYSQL_PASSWORD=pass
        - MYSQL_DATABASE=dbname
        - MYSQL_USER=username
      ports:
        - "3306:3306"
      volumes:
        - "./db:/var/lib/mysql"
  

搬运工-compose.yml

docker-compose up -d --build

然后执行以下操作:

{{1}}