Docker service within the gitlab ci/cd is unable to communicate with each other

I am trying to pull an image and using as docker service in a pipeline job to perform integration test against it.
http://containername:port is defined as pipeline variable but this is not resolving during the job execution though the container is running at that time.