Thursday, March 23, 2017

Socket connection into Docker initially succeeds then fails

Leave a Comment

Running under MacOS I am connecting from a node.js app with net.Socket() into a Docker container running on the same host, which contains a C++ sockets server under Centos. The Docker run command is:

docker run -it --rm -p 14000-14010:14000-14010 -v /Users/me/Development/spdz:/spdz spdz/spdzdev 

When the c++ server in docker is not running, I see a successful connection in node followed 3ms later by a socket closed message.

It appears as if a proxy in front of the container is accepting the request, passing it through to Docker where it is rejected. However this leads to erroneous messages in my front end application which thinks the connection was successful, only to find out later it was not.

I would like to see a simple connection declined. Any suggestions as to how this may be remedied or better understood would be helpful.

I am confident that the behaviour is introduced by Docker, as running the components outside Docker gives the expected immediate failure on connection. Also I have tried mapping the exported ports to an external network interface rather than localhost but see the same behaviour.

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment