【问题标题】:gitlab runner: mysqld: Can't read dir of '/etc/mysql/conf.d/'gitlab runner:mysqld:无法读取'/etc/mysql/conf.d/'的目录
【发布时间】:2018-07-23 22:37:11
【问题描述】:

我在 docker 中使用 gitlab 运行器。

它使用我们自己的 php 镜像和 mysql:5.7 镜像。以前可以,但现在我们可以在 CI 作业启动时看到此错误:

Running with gitlab-runner 10.4.0 (857480b6)
  on gitlab-runner-2 (00929f5e)
Using Docker executor with image registry.blahblah.work/infra/docker-base/php ...
Starting service mysql:5.7 ...
Pulling docker image mysql:5.7 ...
Using docker image mysql:5.7 ID=sha256:f008d8ff927dc527c5a57251b45cead7c9259c16a6a93c144f397eaafc103d36 for mysql service...
Waiting for services to be up and running...

*** WARNING: Service runner-00929f5e-project-4-concurrent-0-mysql-0 probably didn't start properly.

Error response from daemon: Cannot link to a non running container: /runner-00929f5e-project-4-concurrent-0-mysql-0 AS /runner-00929f5e-project-4-concurrent-0-mysql-0-wait-for-service/runner-00929f5e-project-4-concurrent-0-mysql-0

2018-02-13T08:49:03.752410664Z 
2018-02-13T08:49:03.752468595Z ERROR: mysqld failed while attempting to check config
2018-02-13T08:49:03.752476292Z command was: "mysqld --verbose --help"
2018-02-13T08:49:03.752481759Z 
2018-02-13T08:49:03.752486693Z mysqld: Can't read dir of '/etc/mysql/conf.d/' (Errcode: 13 - Permission denied)
2018-02-13T08:49:03.752491885Z mysqld: [ERROR] Fatal error in defaults handling. Program aborted!

变量已设置:

variables:
  MYSQL_DATABASE: test
  MYSQL_ROOT_PASSWORD: password

我应该如何调试和修复这个问题?

【问题讨论】:

  • 你找到答案了吗???
  • @Shubham 不,我每次执行测试时都会创建新的数据库。
  • 我通过将 gitlab-runner 设置从 privilaged: true 更改为 privilaged: false 解决了这个问题

标签: mysql docker gitlab gitlab-ci


【解决方案1】:

你需要改变你的 docker compose 文件,你应该添加 privileged: true 我的样子:

  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

【讨论】:

    猜你喜欢
    • 2020-12-24
    • 1970-01-01
    • 1970-01-01
    • 2016-09-26
    • 1970-01-01
    • 2015-10-16
    • 1970-01-01
    • 1970-01-01
    • 2019-11-14
    相关资源
    最近更新 更多