'gitlab Failed to connect to dockerdemo-mvc port 3892 after 0 ms: Connection refused

When i run curl command i am getting "Failed to connect to dockerdemo-mvc port 3892 after 0 ms: Connection refused" any thought why it's getting this error? I tried localhost/docker..etc still all are failing

.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

pipeline: [pipeline][1]

public test repo in gitlab. https://gitlab.com/venkat-test-group/Docker.DotNetCoreDemo [1]: https://i.stack.imgur.com/RqLra.png

Edited and tested based on suggestion (but still not working)

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


Solution 1:[1]

Based on the output from curl, the dockerdemo-mvc service isn't running.

I would pull the $CI_REGISTRY_IMAGE:api and run it locally. Follow the logs, then hit the API with curl.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Richard