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:

stage: docker
- development
- 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{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.

% 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 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 Ip, IP. Nothing.