当我运行curl命令时,我会得到“连接到dockerdemo端口3892失败,在0 ms之后:连接被拒绝”我试过本地主机/码头……等等,都失败了。
..gitlab ci.yml:
default:
image: mcr.microsoft.com/dotnet/core/sdk:3.1
services:
- docker:dind
stages:
- build
- acceptance
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
DOCKER_DRIVER: overlay2
IMAGE_NAME: docker.dotnetcoredemo
curl api testing:
stage: acceptance
image: curlimages/curl
services:
- name: $CI_REGISTRY_IMAGE:api
alias: dockerdemo-mvc
script:
- sleep 15
- curl http://dockerdemo-mvc:3892/api/customers管道:管道
在gitlab进行公开测试。https://gitlab.com/venkat-test-group/Docker.DotNetCoreDemo 1:https://i.stack.imgur.com/RqLra.png
根据建议进行编辑和测试(但仍然不起作用)
docker-pull:
stage: pull
image: docker:latest
before_script:
- docker --version
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker pull $CI_REGISTRY_IMAGE:api
curl api testing:
stage: acceptance
image: curlimages/curl
services:
- name: $CI_REGISTRY_IMAGE:api
alias: dockerdemo-api
script:
- sleep 15
- curl http://dockerdemo-api:3892/api/customers
environment:
name: staging
dependencies:
- docker-pull发布于 2022-05-17 17:08:38
基于curl的输出,dockerdemo服务没有运行。
我会提取$CI_REGISTRY_IMAGE:api并在本地运行它。遵循日志,然后使用curl访问API。
https://stackoverflow.com/questions/72245359
复制相似问题