I am new to the concept of dockers and containers. So sorry if I frame the question in a wrong way. The issue is -

An aws EC2 instance which is running docker is failing load balancer health checks. I tired to curl docker container hosted web service from the instance and it returned curl: (56) Recv failure: Connection reset by peer I went through this question

As suggested in the answer I used netstat -an|grep LISTEN from within the container and it didn't return anything (No error. The control just went to next line returning nothing).

I have no clue what to do right now. Please help.

  • 1
    Can you post the contents of your Dockerfile/docker-compose.yml and the command you run to spin up the containers? – ryekayo Dec 5 '18 at 15:09

My guess is that nothing really listens on that port. Is your container actually running the service you want it to run? Does ps ax from inside the running container show the process you expect? (e.g. httpd or nginx or whatwever you expect to listen on that port?)

Make sure your Dockerfile has the appropriate EXPOSE {port}, RUN {command} and/or CMD ... statements. That will ensure that 1) the command you want is actually started and 2) the port it listens on is exposed to the outside world.

| improve this answer | |
  • I want my container to run nginx and ps ax shows that nginx is running – sdy_159 Dec 6 '18 at 4:58
  • @sdy_159 post your Dockerfile – MLu Dec 6 '18 at 5:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.