Docker Percona 在 macOS 中退出并出现错误 3

Docker Percona exits with error 3 in macOS

在 macOS 10.11 中使用 Docker 工具箱。尝试通过 docker-compose:

启动 Percona 5.7 容器
  percona:
    image: percona:5.7
    user: "1000:50"
    restart: "no"
    volumes:
      - ./db:/var/lib/mysql:rw
    ports:
      - 3306:3306
    environment:
      MYSQL_ROOT_PASSWORD: qwerty

但是当运行:

docker-compose up

它显示了这个日志:

percona_1     | Initializing database
percona_1     | 2018-02-27T18:21:40.471171Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
percona_1     | 2018-02-27T18:21:40.471336Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
percona_1     | 2018-02-27T18:21:40.509126Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
percona_1     | 2018-02-27T18:21:40.511757Z 0 [Warning] One can only use the --user switch if running as root
percona_1     | 
percona_1     | 2018-02-27T18:21:42.900823Z 0 [ERROR] InnoDB: Operating system error number 22 in a file operation.
percona_1     | 2018-02-27T18:21:42.901071Z 0 [ERROR] InnoDB: Error number 22 means 'Invalid argument'
percona_1     | 2018-02-27T18:21:42.901164Z 0 [ERROR] InnoDB: File ./ib_logfile101: 'aio write' returned OS error 122. Cannot continue operation
percona_1     | 2018-02-27T18:21:42.901187Z 0 [ERROR] InnoDB: Cannot continue operation.
docker_percona_1 exited with code 3

你能帮我理解这个问题吗?

说明您使用的文件系统不支持aio。您可以通过将以下行添加到 my.cnf:

来告诉 innodb

innodb_use_native_aio=0

如果在 my.cnf

中启用,也删除 innodb_flush_method = O_DIRECT