gpt4 book ai didi

Docker:Windows主机上的MariaDB/MySQL启动失败

转载 作者:行者123 更新时间:2023-12-04 02:15:17 25 4
gpt4 key购买 nike

我正在尝试使用官方的mariadb docker镜像以及php-fpm和nginx来运行我的Symfony 2应用程序。

想法是将所有数据库文件保留在已安装的文件夹中。在Mac OS上,它可以正常工作-在Windows机器上,每次MariaDB尝试启动时,我都会收到一个错误消息。奇怪的是它实际上能够创建一些文件-我可以看到ibdata1文件,但它的大小为0字节。还有两个aria_log文件,只有几KB的数据,这意味着mysql实际上可以在其中写入数据。

  • 我正在使用docker for windows 1.12.2 beta。但是也尝试了稳定的。
  • (通过用于Windows UI的Docker的“共享驱动器”部分)共享了我用于存储项目的Windows磁盘。
  • dir是100%可写的,因为nginx甚至mysql本身都可以将日志放在那里
  • 我完全不是“磁盘空间不足”,因为日志提示

  • 这是我的docker-compose文件:
    version: '2'
    services:
    db:
    image: mariadb
    ports:
    - "3306:3306"
    environment:
    MYSQL_ROOT_PASSWORD: root
    MYSQL_DATABASE: test
    MYSQL_USER: root
    MYSQL_PASSWORD: root
    volumes:
    - ./docker-runtime/mysql:/var/lib/mysql
    php:
    build: ./docker/php-fpm
    volumes:
    - ./:/var/www/symfony
    - ./docker-runtime/logs/symfony:/var/www/symfony/app/logs
    links:
    - db
    nginx:
    build: ./docker/nginx
    ports:
    - "80:80"
    links:
    - php
    volumes_from:
    - php
    volumes:
    - ./docker-runtime/logs/nginx/:/var/log/nginx

    这是我执行 docker-compose up时日志所说的内容:
    db_1     | 2016-10-18 13:14:06 7f79eed7f7c0 InnoDB: Error: Write to file ./ibdata1 failed at offset 0.
    db_1 | InnoDB: 1048576 bytes should have been written, only 0 were written.
    db_1 | InnoDB: Operating system error number 22.
    db_1 | InnoDB: Check that your OS and file system support files of this size.
    db_1 | InnoDB: Check also that the disk is not full or a disk quota exceeded.
    db_1 | InnoDB: Error number 22 means 'Invalid argument'.
    db_1 | InnoDB: Some operating system error numbers are described at
    db_1 | InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html
    db_1 | 2016-10-18 13:14:06 140161674901440 [ERROR] InnoDB: Error in creating ./ibdata1: probably out of disk space
    db_1 | 2016-10-18 13:14:06 140161674901440 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
    db_1 | 2016-10-18 13:14:06 140161674901440 [ERROR] Plugin 'InnoDB' init function returned error.
    db_1 | 2016-10-18 13:14:06 140161674901440 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
    db_1 | 2016-10-18 13:14:06 140161674901440 [ERROR] Unknown/unsupported storage engine: InnoDB
    db_1 | 2016-10-18 13:14:06 140161674901440 [ERROR] Aborting

    我真的很感谢在这个问题上的任何想法,因为我目前正要拔头发

    最佳答案

    可能您有权限问题。要丢弃,请将您的docker-compose.yml更改为使用命名卷:

    version: '2'
    services:
    db:
    image: mariadb
    ports:
    - "3306:3306"
    environment:
    MYSQL_ROOT_PASSWORD: root
    MYSQL_DATABASE: test
    MYSQL_USER: root
    MYSQL_PASSWORD: root
    volumes:
    - mysql:/var/lib/mysql
    php:
    build: ./docker/php-fpm
    volumes:
    - ./:/var/www/symfony
    - ./docker-runtime/logs/symfony:/var/www/symfony/app/logs
    links:
    - db
    nginx:
    build: ./docker/nginx
    ports:
    - "80:80"
    links:
    - php
    volumes_from:
    - php
    volumes:
    - ./docker-runtime/logs/nginx/:/var/log/nginx
    volumes:
    mysql:

    尝试查看mysql错误是否消失。

    问候

    关于Docker:Windows主机上的MariaDB/MySQL启动失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40109596/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com