I have a back-end app that i deploy in a Docker container. The app is running just fine, but when I try, from within the app, to open a TCP socket (in order to connect to it with a GUI front-end from the host) by calling connect, the call fails with errno 111, namely ECONNREFUSED (connection refused).
The requested socket details: 0.0.0.0:50000
i run the image with: docker run -p 50000:50000 my_image
Both the host and the container are running Ubuntu 20.04.
Doing this directly on the host works just fine.
Any ideas?
Thanks.
Don't ask me why, but adding -it to the docker run command fixed it...