gpt4 book ai didi

laravel - gitlab-ci期间无法在docker中启动MySQL服务

转载 作者:行者123 更新时间:2023-12-02 18:29:35 25 4
gpt4 key购买 nike

我从 Laravel Dusk CI 的示例中获取了以下 .gitlab-ci :

stages:
- build
- test

# Variables
variables:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: root
MYSQL_PASSWORD: secret
MYSQL_DATABASE: test
DB_HOST: mysql
DB_CONNECTION: mysql

build:
stage: build
services:
- mysql:5.7

image: chilio/laravel-dusk-ci:stable
script:
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
# - npm install # if you need to install additional modules from your projects package.json
# - npm run dev # if you need to run dev scripts for example laravel mix
cache:
key: ${CI_COMMIT_REF_NAME}
paths:
# these are only examples, you should modify them according to your project,
# or remove cache routines entirely, if they are causing any problems on your next builds..
# below are 2 safe ones if you use composer install and npm install in your stage script
- vendor
- node_modules
# - /resources/assets/vendors # for example if you put your vendor node-libraries there

test:
stage: test
cache:
key: ${CI_COMMIT_REF_NAME}
paths:
- vendor
- node_modules
policy: pull

services:
- mysql:5.7

image: chilio/laravel-dusk-ci:stable
script:
- cp .env.example .env
# - cp phpunit.xml.ci phpunit.xml # if you are using custom config for your phpunit tests in CI
- configure-laravel
- start-nginx-ci-project
- ./vendor/phpunit/phpunit/phpunit -v --coverage-text --colors --stderr
# - phpunit -v --coverage-text --colors --stderr # if you want to use preinstalled phpunit
- php artisan dusk --colors --debug

artifacts:
paths:
- ./storage/logs # for debugging
- ./tests/Browser/screenshots
- ./tests/Browser/console
expire_in: 7 days
when: always

但是,当运行者执行作业时,我不断收到以下警告:

Using Docker executor with image chilio/laravel-dusk-ci:stable ...
Starting service mysql:5.7 ...
Pulling docker image mysql:5.7 ...
Using docker image sha256:66bc0f66b7af6ba3ea96582685d3afcd6dff93c2f8999da0ffadd67b280db548 for mysql:5.7 ...
Waiting for services to be up and running...

*** WARNING: Service runner-237f18d2-project-23-concurrent-0-mysql-0 probably didn't start properly.

Health check error:
ContainerStart: Error response from daemon: Cannot link to a non running container: /runner-237f18d2-project-23-concurrent-0-mysql-0 AS /runner-237f18d2-project-23-concurrent-0-mysql-0-wait-for-service/service

Service container logs:
2018-07-11T19:49:03.214991318Z
2018-07-11T19:49:03.215062485Z ERROR: mysqld failed while attempting to check config
2018-07-11T19:49:03.215067480Z command was: "mysqld --verbose --help"
2018-07-11T19:49:03.215070774Z
2018-07-11T19:49:03.215073778Z mysqld: error while loading shared libraries: libpthread.so.0: cannot stat shared object: Permission denied

我尝试在 config.toml 中将运行器设置为特权:

privileged = true

最佳答案

解决问题:

mysqld:加载共享库时出错:libpthread.so.0:无法统计共享对象:权限被拒绝

  • 第 1 步:更新您的软件和内核(可能):

    apt-get update && apt-get upgrade

  • 第二步:安装docker依赖包:

    • (ubuntu/debian): apt-get install apt-transport-https ca-certificates curl gnupg2 software properties-common
    • (centos/redhat):yum-utils device-mapper-persistent-data lvm2
  • 第 3 步:重启服务器并重启 docker-ce:

    重启

    systemctl restart docker-ce

关于laravel - gitlab-ci期间无法在docker中启动MySQL服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51293321/

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