I'm having problems with TCP communication from my Docker

Hi, I’m having a problem while writing my unit tests for my node application.
From my backend I contact Stripe APIs and Paypal APIs, my unit tests crashes every time I try to run my tests inside the docker because of a connection problem.
When I run the same tests from my local machine they pass without problems.
So I think this has to be with the ports exposure but I’m not sure because I’m not an expert.
This is the command I’m using to start my container:

docker run -p 8080:8080 -p 50000:50000 -v /Users/nicolovanzo/Documents/jenkins:/var/jenkins_home -v /Users/nicolovanzo/Documents/work/storm/backups/firestore:/var/jenkins_home/firestore  -v /Users/nicolovanzo/Documents/work/storm/firebase_keys/dev.json:/var/jenkins_home/firebase_keys/dev.json jenkins/jenkins

In my code whenever I try to contact an API outside of my docker it crashes saying:

    data: { code: 'ECONNRESET' }

I can’t find any solution online so I think you can help me. I would be really happy if you can find a solution or lead me to it.