在 .gitlab-ci.yml 中定义服务后无法解析主机

在 .gitlab-ci.yml 中定义服务后无法解析主机

我尝试将 minio 服务添加到我的 Gitlab CI 配置中,但无法访问主机。我按照此处描述的步骤进行操作:https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#define-image-and-services-from-gitlab-ciyml

如何从测试阶段访问minio服务?

image: node:10

test1:
  stage: test
  script:
    - curl http://minio__minio:9000/minio
  services:
  - name: minio/minio:latest
    entrypoint: ["/usr/bin/docker-entrypoint.sh"]
    command: ["minio"]

variables:
  MINIO_ACCESS_KEY: "AKIAIOSFODNN7EXAMPLE"
  MINIO_SECRET_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
  DOCKER_DRIVER: overlay2

跑步者日志:

Running with gitlab-runner 11.11.0-rc2 (7f58b1ec)
  on docker-auto-scale 0277ea0f
Using Docker executor with image node:10 ...
Starting service minio/minio:latest ...
Pulling docker image minio/minio:latest ...
Using docker image sha256:85e7673bf3de8581936e7121696f1d9166d79b906c3599777c9ba7cd24b49606 for minio/minio:latest ...
Waiting for services to be up and running...

*** WARNING: Service runner-0277ea0f-project-12082693-concurrent-0-minio__minio-0 probably didn't start properly.

Health check error:
ContainerStart: Error response from daemon: Cannot link to a non running container: /runner-0277ea0f-project-12082693-concurrent-0-minio__minio-0 AS /runner-0277ea0f-project-12082693-concurrent-0-minio__minio-0-wait-for-service/service (executor_docker.go:1237:0s)

Service container logs:
2019-05-09T10:10:30.609244120Z NAME:
2019-05-09T10:10:30.609318048Z   minio - Cloud Storage Server.
2019-05-09T10:10:30.609322374Z 
2019-05-09T10:10:30.609325117Z DESCRIPTION:
2019-05-09T10:10:30.609327974Z   MinIO is an Amazon S3 compatible object storage server. Use it to store photos, videos, VMs, containers, log files, or any blob of data as objects.
2019-05-09T10:10:30.609332017Z 
2019-05-09T10:10:30.609334500Z USAGE:
2019-05-09T10:10:30.609337270Z   minio [FLAGS] COMMAND [ARGS...]
2019-05-09T10:10:30.609339846Z 
2019-05-09T10:10:30.609342409Z COMMANDS:
2019-05-09T10:10:30.609344925Z   server   start object storage server
2019-05-09T10:10:30.609347480Z   gateway  start object storage gateway
2019-05-09T10:10:30.609349993Z   update   update minio to latest release
2019-05-09T10:10:30.609352541Z   version  print version
2019-05-09T10:10:30.609356744Z   
2019-05-09T10:10:30.609359377Z FLAGS:
2019-05-09T10:10:30.609361973Z   --config-dir value, -C value  [DEPRECATED] Path to legacy configuration directory. (default: "/root/.minio")
2019-05-09T10:10:30.609364988Z   --certs-dir value, -S value   Path to certs directory. (default: "/root/.minio/certs")
2019-05-09T10:10:30.609367742Z   --quiet                       Disable startup information.
2019-05-09T10:10:30.609370463Z   --anonymous                   Hide sensitive information from logging.
2019-05-09T10:10:30.609373142Z   --json                        Output server logs and startup information in json format.
2019-05-09T10:10:30.609375957Z   --help, -h                    Show help.
2019-05-09T10:10:30.609378524Z   
2019-05-09T10:10:30.609380982Z VERSION:
2019-05-09T10:10:30.609383482Z   2019-05-02T19:07:09Z

*********

Pulling docker image node:10 ...
Using docker image sha256:5a401340b79fc623c9aec2a679f16ceb8a3b8865446691564bb104394fd0ce20 for node:10 ...
Running on runner-0277ea0f-project-12082693-concurrent-0 via runner-0277ea0f-srm-1557396559-298ee740...
Initialized empty Git repository in /builds/lukas-tr/test-project-232354245/.git/
Fetching changes...
Created fresh repository.
From https://gitlab.com/lukas-tr/test-project-232354245
 * [new branch]      master     -> origin/master
Checking out ae529182 as master...

Skipping Git submodules setup
$ curl http://minio__minio:9000/minio
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: minio__minio
ERROR: Job failed: exit code 1

相关内容