I've a question about docker containers and sockets. Today i've discovered that, docker containers with mapped port -p 80:80 (or etc ports) on the host system, doesn't show up when i use netstat, ss or lsof -i (also tried with sudo, no chance). Then i tried to test, open a listener port 80 with sudo nc -l -p 80, but no chance, it refused to connect port 80, although this port doesn't show up opened by some process.

I think this problem occurs due to containerization or network namespaces, but there are should be some commands to list used sockets by low level, kernel level?

p.s: When i tried to use docker host network interface ip address on port mapping (-p, it showed up using above commands.

p.s-2: lsof | grep -w 80 output:

lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
Xorg        718                             root   37u      CHR              13,80       0t0      10891 /dev/input/event16
Xorg        718   749 Xorg:disk             root   37u      CHR              13,80       0t0      10891 /dev/input/event16
Xorg        718   778 Xorg:disk             root   37u      CHR              13,80       0t0      10891 /dev/input/event16
Xorg        718   787 Xorg:disk             root   37u      CHR              13,80       0t0      10891 /dev/input/event16
Xorg        718   841 InputThre             root   37u      CHR              13,80       0t0      10891 /dev/input/event16
  • What does docker inspect say? is it using bridge mode or is it actually providing a complete new IP address? – Theresa Forster Sep 9 '19 at 14:19
  • Perhaps the port is routed. Since no local process listens on it no process is shown. – Ned64 Sep 9 '19 at 14:24
  • Can you see the mapped port by something like lsof | grep -w 80 (as root)? – Ned64 Sep 9 '19 at 14:29
  • @TheresaForster , i've uploaded the inspect reults here: ctxt.io/2/AABAtIUXEg – Safar Safarli Sep 9 '19 at 15:01
  • @Ned64, i've used "lsof -i" command to show listening ports, but no luck, it is not listed there. Only ipv6 listening port 80 shows there owned by docker – Safar Safarli Sep 9 '19 at 15:04

Your Answer

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

Browse other questions tagged or ask your own question.