What should I do if my application is not listening on the TCP/IP socket I expect it to?

Solution Verified - Updated -

Issue

  • When starting an application on bare-metal, in a virtual machine, or in a containerized environment, I cannot connect to the application externally or internally (over loopback).
  • If I expect my application to listen on TCP port 8080, if I try to connect to it locally it may fail like so:
$ curl localhost:8080
curl: (7) Failed to connect to localhost port 8080: Connection refused
  • I do not see the application listening in socket statistics, such as that provided by netstat:
$ netstat -ltnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1744/cupsd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1746/sshd: /usr/sbi
tcp6       0      0 :::22                   :::*                    LISTEN      1746/sshd: /usr/sbi
  • I would expect to see my application listening in the above on local address 0.0.0.0:8080 but it does not appear.

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9
  • Docker or Podman container engines.
  • Red Hat OpenShift Container Platform 3
  • Red Hat OpenShift Container Platform 4

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content