GitLab CI Services - Service (Network) Name?

I would like to build an application, then build that application into a container image, then run that image as a service. The goal would be for the ci job to then validate the APIs on that service, imaged application. (Basing on the documentation here
Services | GitLab ) I have been trying something like the below. I was originally using our application but the same can be reproduced with netcat.

Below is an example…

stages:
   - test

test:
  image: <registry path>/linux-image-with-netcat:latest
  services:
    - name: <registry path>/linux-image-with-netcat:latest
      alias: service-under-test
      entrypoint: ["nc", "-l", "10001"]
  script:
      - sleep 30 # delay for debugging
      - |
        while [ 1 ]
        do
          echo hi | nc service-under-test 10001
        done

There are two problems. The first is visible in the job logs. netcat fails to connect to service-under-test. (I have tries to use the actual image name, minus the registry. That doesn’t work either.). Adding the sleep 30 gives me a chance to ssh into the runner. Via the worker I can see that the service-under-test (nc -l 10001) did start…But for some reason it ended? This explains why the ‘echo hi | nc service-under-test 10001’ couldn’t connect to it.

Any suggestions how to make this work? (I’m questioning if this has to do with the fact I need to include a registry name to the image. Unlike the examples assuming a default public registry that is configured. Although my image does start. So that leads back to the question why is it stopping? I do have port 10001 EXPOSE(d) in the Dockerfile def.)

Here are what the job logs look like…

Running with gitlab-runner 14.7.0 (98daeee0)
  on ...-docker 1KyvZujB
Preparing the "docker" executor
00:03
Using Docker executor with image .../base-containers/ci-dev-env:latest ...
Starting service .../examples/gitlabci-service-test:initial ...
Authenticating with credentials from job payload (GitLab Registry)
Pulling docker image .../examples/gitlabci-service-test:initial ...
Using docker image sha256:... for .../examples/gitlabci-service-test:initial with digest .../examples/gitlabci-service-test@... ...
Waiting for services to be up and running...
Authenticating with credentials from job payload (GitLab Registry)
Pulling docker image .../base-containers/ci-dev-env:latest ...
Using docker image sha256:... for .../ci-dev-env:latest with digest .../ci-dev-env@sha256:... ...
Preparing environment
00:00
Running on runner-1kyvzujb-project-110-concurrent-0 via ......
Getting source from Git repository
00:01
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in /builds/examples/gitlabci-service-test/.git/
Checking out 11898446 as initial...
Removing build/
Skipping Git submodules setup
Downloading artifacts
00:01
Downloading artifacts for build-code (1020)...
Downloading artifacts from coordinator... ok        id=1020 responseStatus=200 OK token=5GZyBVxZ
Executing "step_script" stage of the job script
00:31
Using docker image sha256:... for .../base-containers/ci-dev-env:latest with digest .../base-containers/ci-dev-env@sha256:... ...
$ sleep 30 # When I check docker ps -a on runner at this point the service container already stopped.  Although if I do the same docker run --it test manually it works.  No errors present.  If I set bad entrypoint on service that errors in job logs.
$ while [ 1 ] # collapsed multi-line command
nc: getaddrinfo for host "service-under-test" port 10001: Name or service not known
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit code 1