Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
docker编写mysql aio写入错误W10_Mysql_Docker_Docker Compose - Fatal编程技术网

docker编写mysql aio写入错误W10

docker编写mysql aio写入错误W10,mysql,docker,docker-compose,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

我想使用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数据库时,我得到以下输出:

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...
我认为volume-InnoDB:File操作调用有问题:“aio write”。我发现的一个建议是将innodb_use_native_aio设置为0,但将其添加到section environment中的docker-compose.yml中并没有帮助

我使用的是Docker版本17.07.0-ce,构建8784753,Docker compose版本1.15.0,构建e12f3b94,通过windows10 home上的Docker工具箱安装


你知道怎么解决这个问题吗?

为我工作!但是您应该在Dockerfile中添加innodb_use_native_aio=0 config,而不是在docker-compose.yml文件中

以下是对我有效的解决方案:

Dockerfile mysql

docker-compose.yml

然后执行以下操作:

docker-compose up -d --build
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"
docker-compose up -d --build