This issue is from a machine without net-tools.x86_64 : Basic networking tools
pre-installed, so netstat
command does not exist. When watching docker registry pod setup, ansible runs netstat -tunlp | grep 5000
to check 5000 port, failed.
Is there other way around to check if the 5000 port is up or not? Yes.
1 | - name: Wait for docker registry to come up |
Here I watch /proc/net/tcp6
kernel file to see what ipv6 port is running (docker registry port is in ipv6 scope here). for ipv4, use /proc/net/tcp
.
This file is not plain text, after use cut
to extra the port field, then convert the number to decimal. see https://www.kernel.org/doc/Documentation/networking/proc_net_tcp.txt