Most docker containers contain a minimum set of packages. Sometimes it's necessary to check if a program is listening on the correct port. Is it possible to use /proc to get at all the information needed.

This script uses /proc to create a list of ports just like netstat:

AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available - awk_netstat.sh

Here's what it looks like:

#!/bin/bash
# All in one
awk 'function hextodec(str,ret,n,i,k,c){
    ret = 0
    n = length(str)
    for (i = 1; i <= n; i++) {
        c = tolower(substr(str, i, 1))
        k = index("123456789abcdef", c)
        ret = ret * 16 + k
    }
    return ret
}
function getIP(str,ret){
    ret=hextodec(substr(str,index(str,":")-2,2)); 
    for (i=5; i>0; i-=2) {
        ret = ret"."hextodec(substr(str,i,2))
    }
    ret = ret":"hextodec(substr(str,index(str,":")+1,4))
    return ret
} 
NR > 1 {{if(NR==2)print "Local - Remote";local=getIP($2);remote=getIP($3)}{print local" - "remote}}' /proc/net/tcp