Unable to access port 5000 inside container for 20 minutes

Setup

Cloud: AWS
Rancher server: v 1.0.2
Mode: Cattle
Hosts: RancherOS hosts (v. 0.6.1)

Problem

We’ve created an “http api” container/image serving requests on port 5000. When the container is started on a development box we are able to attach to it and run a curl command inside the container targeting http://localhost:5000 and receive a response (http 404) without any issues. The 404 status code is expected!

However, when the same image is deployed to our rancher environment, when the container is started, running the same curl command inside the container results in “connection refused”. If we continue to run the curl command (in a loop) once every minute, we can clearly see that the container starts responding after 20 minutes of “connection refused”. The same thing happens when we have a running (and working) container that is restarted. Again, no response for 20 minutes and then it suddenly starts responding to requests.

We’ve tried searching logfiles for any clues but have been unable to find anything that points to the issue.

Anyone experiencing the same issue?

Failing

curl -v http://localhost:5000
* Rebuilt URL to: http://localhost:5000/
* Hostname was NOT found in DNS cache
*   Trying ::1...
* connect to ::1 port 5000 failed: Connection refused
*   Trying 127.0.0.1...
* connect to 127.0.0.1 port 5000 failed: Connection refused
* Failed to connect to localhost port 5000: Connection refused
* Closing connection 0
curl: (7) Failed to connect to localhost port 5000: Connection refused

Success

curl -v http://localhost:5000
* Rebuilt URL to: http://localhost:5000/
* Hostname was NOT found in DNS cache
*   Trying ::1...
* Connected to localhost (::1) port 5000 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.38.0
> Host: localhost:5000
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Date: Wed, 26 Oct 2016 13:32:23 GMT
< Content-Length: 0
* Server Kestrel is not blacklisted
< Server: Kestrel
<
* Connection #0 to host localhost left intact