0

I've an express application that takes data from an IronMQ push queue. I've Dockerized this app and on running the application in a Docker Container, after some idle time say 20-30 mins, the App throws an error and exits out:

Error: read tcp 192.168.59.3:50346->192.168.59.103:2376: read: operation timed out

My boot2docker ip --> 192.168.59.103

I've forwarded the port at 3000.

I've tried using process object to catch uncaught exception but to no help.

Note: I've ran the app outside of docker on my local, and the app runs fine without throwing an error and logging out. So the problem seems to with docker.

riser101
  • 610
  • 6
  • 23
  • what do the logs of IronMQ say? Can you `nc` 192.168.59.103:2376 from the outside? Can you `docker exec` into both containers and check if the connection is still open. – CFrei Dec 04 '15 at 10:11
  • @CFrei: I logged inside the conatiner, the connection in fine. I've checked the app is running in the background and running exactly as it is supposed to – riser101 Dec 04 '15 at 11:09
  • I'm wondering why is it throwing that err msg and exiting out of the console while still running in the background. – riser101 Dec 04 '15 at 11:11
  • What version of Docker are you running? – Travis Reeder Dec 04 '15 at 16:07

1 Answers1

4

As it turns out, when you execute the docker run command in the attached mode i.e with the -a parameter or wiihout the -d parameter, something like:

docker run -a <imageID> or docker run <imageID>

Docker detaches from the container by default after sometime and runs the container in detached mode. Meaning your application runs fine in the background.

Hence the error: timed out

Note: This is not explicitly mentioned in the docker docs, so thought this could be documented here for future reference.

riser101
  • 610
  • 6
  • 23