From my Docker container I forward the port 8545
as below
ports:
- '127.0.0.1:8545:8545'
And after run the container, if I run lsof -i :8545
it shows me two processes with the same PID.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
vpnkit 6576 Admin 27u IPv4 0xfdda6e6d5013cf77 0t0 TCP localhost:8545 (LISTEN)
vpnkit 6576 Admin 28u IPv6 0xfdda6e6d4509106f 0t0 TCP localhost:8545 (LISTEN)
Why there are two processes running?
There are no two different processes as you can see under the PID
column. The reason lsof
lists more than one entry is because the tool shows you which process has handles to some file descriptors and in your case the single process has two of them, because it is bound on both sockets - IPv4 and IPv6 (as seen under the TYPE
column).
You can restrict the output by using the -i
parameter twice:
lsof -i 4 -i :8545
This filters on both, port and socket which should give the expected output. For your original question: From a docker perspective, everything is fine.