How to connect to docker container inside of executor

Going a little nuts trying to start a container within a gitlab runner using socket based docker executor. I cannot for the life of me find out how to hit it with the correct ip. Here is the basic excerpt from the yaml file:

docker_test:
stage: docker
only:
- development
script:
- export TEST_PORT=(( ((RANDOM<<15)|RANDOM) % 63001 + 2000 )) - docker run --rm --detach -p {TEST_PORT}:8080 --name “cbox-test-{CI_COMMIT_SHA}" ortussolutions/commandbox - docker ps && sleep 25 - docker inspect "cbox-test-{CI_COMMIT_SHA}”
- export DOCKER_HOST=(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cbox-test-{CI_COMMIT_SHA});
- echo DOCKER_HOST - curl http://0.0.0.0:{TEST_PORT}

I am just trying to run an image on a random port and get its docker ip address so I can hit it. And always get connection refused.

$ echo DOCKER_HOST 172.17.0.5 curl http://127.0.0.1:${TEST_PORT}
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0curl: (7) Failed to connect to 0.0.0.0 port 40283: Connection refused

The server starts fine, problem is I don’t know how to hit this sucker. I have tried the IP, the 127.0.0.1 Ip, 0.0.0.0 IP. Nothing.