如何在gitlab-ci.yml中使用netcat

use*_*834 5 netcat gitlab-ci

我试着在gitlab跑步者中检查服务是否正常.

为此,我用netcat在我的.gitlab-ci.yml

image: python:latest

before_script:
  - apt-get update -yq
  - apt-get install -y python-dev python-pip tree
  ## check about Rabbit
  - apt-get install -y curl netcat
  - nc -v -zw3 rabbitmq 15672
Run Code Online (Sandbox Code Playgroud)

但是当我跑步时我得到这个错误::

Unpacking netcat (1.10-41) ...
Setting up netcat-traditional (1.10-41) ...
update-alternatives: using /bin/nc.traditional to provide /bin/nc (nc) in auto mode
Setting up netcat (1.10-41) ...
$ nc -zw3 rabbitmq 15672
$ nc -v -zw3 rabbitmq 15672
rabbitmq [172.17.0.2] 15672 (?) : Connection refused
ERROR: Job failed: exit code 1
Run Code Online (Sandbox Code Playgroud)