mardi 17 juillet 2018

Docker cannot link to a non running container using mysql

I'm trying to use the CI (Continuous Integration) of gitlab to make automatic test (with Dusk) for a Laravel project.

But I'm always getting this error after the initilization of 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

version used

I'm using docker (18.03.1-ce) to manage everything.

I have Gitlab (10.0.3), gitlab-runner (11.0). I also found this docker image which seems perfect for my use case.

I dont use docker-compose (so this thread does not apply to me).

warning

I also have this warning at the begining

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

But the container is well created and I also have thoses informations just after the warning

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

I'm building everything with this .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

attempts

  • I tried to reboot the whole machine and then the docker service
  • I removed everything and rebuild from scratch
  • I launched the runner with --privileged and checked the config.toml
  • I tried the 3 versions of chilio/laravel-dusk as explained here

logs

This is the log of the gitlab runner container

# 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

Aucun commentaire:

Enregistrer un commentaire