netstat or alternative in docker ubuntu server 16.04 container
As you can see from https://packages.ubuntu.com/xenial/amd64/net-tools/filelist, netstat
is provided by the net-tools
package. Therefore, you can get netstat
by running:
sudo apt update
sudo apt install net-tools
net-tools
is probably not installed by default in the Docker image for Ubuntu 16.04 to keep the image size as small as possible.
In my opinion is better to begin adapting yourself to new tools.
ss
is auto-defined as "another utility to investigate sockets"
ss -ltu
Will show listening sockets for tcp and udp.
For more information you can use ss --help
or man ss
. The program ss
can be found in the iproute2
package.
The version of ubuntu that's provided for use in containers has much less installed in it than a typical desktop installation.
Netstat is still available in Ubuntu 16.04 (via the net-tools package). It's just that that package isn't installed inside docker containers by default.