Connecting an application to a MongoDB running in a remote docker container

Hello guys, I am new to circle ci. I am trying to setup a pipleline to run the jest tests, for the tests to run the app connects to a remote docker image of the mongoDB but for some reason the app is unable to connect, I can tell that the remote docker containers are running using docker-compose ps -a but for some reason the app is still unable to connect to the DB the error is a connection timeout the db expects the app to connect from the localhost

The Job