Skip to content

Instantly share code, notes, and snippets.

View artem-shestakov's full-sized avatar

Artem artem-shestakov

View GitHub Profile
@artem-shestakov
artem-shestakov / c_ports.sh
Last active March 24, 2023 11:13
Check ports/connections inside containers
#!/bin/bash
containers=`docker ps -q`
for container in $containers; do
c_pid=`docker inspect -f '{{ .State.Pid }}' $container`
c_name=`docker inspect -f '{{ .Name }}' $container`
echo "--- CONTAINER: $c_name ---"
nsenter -t ${c_pid} -n netstat -anp
echo -e "\n"