我正在尝试使用docker compose和以下配置创建mysql数据库(在docker容器上,在windows 10主机上使用docker toolbox):
docker-compose.yml公司
version: '2'
services:
db:
container_name: test
restart: unless-stopped
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: 'password'
MYSQL_DATABASE: 'mydb'
ports:
- 6612:3306
volumes:
- ./db:/var/lib/mysql
我在一个只包含 docker-compose.yml
并得到以下输出。
$ docker-compose up
Recreating test ... done
Attaching to test
test | Initializing database
test | 2018-04-21T17:31:30.722810Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
test | 2018-04-21T17:31:30.727269Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
test | 2018-04-21T17:31:30.727618Z 0 [ERROR] Aborting
test |
test | Initializing database
test | 2018-04-21T17:31:30.722810Z 0 [Warning] TIMESTAMP with implicit
.
.
.
它似乎在抱怨现有的文件,但当文件夹是空的,怎么可能有呢?
第二次我运行相同的文件,在相同的空(除了 docker-compose.yml
)我得到:
Starting test ... done
Attaching to test
test | Initializing database
test | 2018-04-21T17:36:12.716214Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
test | 2018-04-21T17:36:12.726611Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
test | 2018-04-21T17:36:13.466867Z 0 [ERROR] InnoDB: Operating system error number 22 in a file operation.
test | 2018-04-21T17:36:13.467174Z 0 [ERROR] InnoDB: Error number 22 means 'Invalid argument'
test | 2018-04-21T17:36:13.467475Z 0 [ERROR] InnoDB: File ./ib_logfile101: 'aio write' returned OS error 122. Cannot continue operation
test | 2018-04-21T17:36:13.467649Z 0 [ERROR] InnoDB: Cannot continue operation.
test exited with code 1
这次它创建了一个 ./db
“我的pwd”中包含几个文件的文件夹:
IBU日志文件1
日志文件101
ibdata1数据库
但是没有什么了,再次运行它,我们就回到了第一个输出。相同的 docker-compose.yml
在ubuntu16.04上可以顺利运行。有谁能告诉我可能出了什么问题吗?
1条答案
按热度按时间dw1jzc5e1#
似乎关键就在这条输出线上:
显然启用aio对我的设置不起作用。我还是不知道为什么,但这个修改了
docker-compose.yml
为我工作:这要归功于安德烈的回答,但他仍然不确定到底是什么问题。尽管我怀疑docker工具箱(与docker for windows相反)可能与此有关。