This Bash script helps you quickly identify which Docker container ports are exposed and which are internal. It's a handy tool for self-checking, especially when you're running multiple containers. The aim is to boost your security by ensuring you're not unintentionally exposing more than you should.
- Download the script.
- Run the script:
./docker_ports.sh
.
Note: My best friend is a colorblind person, so I want software developers to be aware when designing their applications, therefore this script could be run as ./docker_ports.sh --i-am-colorblind
to output everything in the color friendly mode.
- Ports that are exposed to the internet will be displayed in red.
- Ports that are internal-only will appear in green.
Managing Docker containers can get complex, and it's easy to accidentally expose a port you didn't intend to. This script offers a quick and easy way to review your port exposure, helping you identify any potential security risks.
Yeah, it's just a fancy output of docker ps --format '{{.Names}}\t{{.Ports}}'
Stay secure! 🛡️