Centos 上的 Mysql docker 无法正常工作

Centos 上的 Mysql docker 无法正常工作

我使用 centos 作为服务器并且使用 docker-compose 如下:

  mysql:
    build: ./DockerFiles/Mysql
    ports:
    - ${LOCAL_PHP_IP}:${MYSQL_PORT}:3306
    privileged: true
    environment:
      MYSQL_ROOT_PASSWORD: root
    volumes:
    - /opt/mysql_data:/var/lib/mysql

当我跑步的时候

docker-compose up -d

容器将停止,当我检查日志时,出现以下错误:

mysqld: Can't read dir of '/etc/mysql/conf.d/' (Errcode: 2 - No such file or directory)
mysqld: Can't read dir of '/etc/mysql/conf.d/' (Errcode: 2 - No such file or directory)
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
ERROR: mysqld failed while attempting to check config
command was: "mysqld --verbose --help"

我的 Mysql Dockerfile 如下所示:

FROM percona

MAINTAINER Alireza Rahmani Khalili "[email protected]"

ENV TERM xterm

RUN mkdir /etc/mysql/mysql.conf.d
RUN chmod 755 /etc/mysql/mysql.conf.d
RUN chown -R mysql:mysql /etc/mysql/mysql.conf.d
COPY my.cnf /etc/mysql/my.cnf

请考虑仅在 centos 服务器上才会返回此错误,我在本地尝试过,它运行正常。另外,我使用 gitlab-runner 来运行它。

相关内容