docker无法使用mysql链接到未运行的容器

wd2eg0qa  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(457)

我正在尝试使用gitlab的ci(持续集成)为一个laravel项目进行自动测试(使用dusk)。
但我总是在初始化后得到这个错误
composer ERROR: Job failed (system failure): Error response from daemon: Cannot link to a non running container: /runner-0a53e0ab-project-30-concurrent-0-mysql-0 AS /runner-0a53e0ab-project-30-concurrent-0-predefined-5/mysql ###使用的版本
我用docker(18.03.1-ce)来管理一切。
我有gitlab(10.0.3),gitlab runner(11.0)。我还发现这个docker图像似乎非常适合我的用例。
我不使用 docker-compose (所以这条线不适用于我)。

警告

我一开始也有这个警告

Running with gitlab-runner 11.0.0 (5396d320)
  on my-web-runner 0a53e0ab
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:c356247174ed09823171ae537fd70273900103f2474c2eb62d8782ececcba7ab for mysql:5.7 ...
Waiting for services to be up and running...

***WARNING: Service runner-0a53e0ab-project-30-concurrent-0-mysql-0 probably didn't start properly.

Health check error:
service "runner-0a53e0ab-project-30-concurrent-0-mysql-0-wait-for-service" timeout

但这个容器是很好的创建,我也有这些信息后,刚刚警告

Service container logs:
2018-07-17T08:15:15.332803346Z Initializing database
2018-07-17T08:15:18.023855458Z 2018-07-17T08:15:18.020174Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-07-17T08:15:18.979992069Z 2018-07-17T08:15:18.979239Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-07-17T08:15:19.697917282Z 2018-07-17T08:15:19.697211Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 8b6ce71e-8999-11e8-aee6-0242ac110003.
2018-07-17T08:15:19.839972447Z 2018-07-17T08:15:19.838426Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.

.gitlab-ci.yml公司

我正在用这个建造一切

stages:
  - build
  - test

# Variables

variables:
  MYSQL_ROOT_PASSWORD: my_pw
  MYSQL_USER: my_user
  MYSQL_PASSWORD: my_pw
  MYSQL_DATABASE: testing_db
  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

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

  services:
    - mysql:5.7

  image: chilio/laravel-dusk-ci:stable
  script:
    - cp .env.example .env
    - configure-laravel
    - start-nginx-ci-project
    - php artisan dusk

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

尝试

我试着重新启动整个机器,然后是docker服务
我把所有东西都搬走了,从头开始重建
我把跑步者推下水 --privileged 并检查了 config.toml 我尝试了chilio/laravel dusk的3个版本

日志

这是gitlab runner容器的日志


# docker logs gitlab-runner

Starting multi-runner from /etc/gitlab-runner/config.toml ...  builds=0
Running in system-mode.

Configuration loaded                                builds=0
WARNING: 'metrics_server' configuration entry is deprecated and will be removed in one of future releases; please use 'listen_address' instead
Metrics server disabled
Checking for jobs... received                       job=29 repo_url=http://gitlab.local/Customize/Web.git runner=0a53e0ab
ERROR: Job failed (system failure): Error response from daemon: Cannot link to a non running container: /runner-0a53e0ab-project-30-concurrent-0-mysql-0 AS /runner-0a53e0ab-project-30-concurrent-0-predefined-5/mysql  job=29 project=30 runner=0a53e0ab
mfpqipee

mfpqipee1#

尝试重新启动容器; docker restart gitlab-runner .
根据gitlab的最新要求检查服务器

相关问题