Why every developer should know NMAPI hold a firm conviction: cybersecurity is not a topic reserved for professional penetration testers. Every developer who puts a service on a network should be able to answer basic questions: which ports are open on my machine? What services are running? Am I exposed to the outside without meaning to be? NMAP answers all these questions, and it's completely free and open source. I learned it seriously only a few years ago, when I found that a database was listening on a public port I had never consciously opened — a misconfigured Docker bind mount exposing PostgreSQL on 0.0.0.0:5432. If I'd known how to use NMAP earlier, I would have found it myself before someone else did.How port scanning works: TCP, UDP and timingA port is open if a process is listening and responding to incoming connections. NMAP determines port state by sending packets and analyzing responses. open means a completed TCP connection or UDP response received. closed means the system responds with RST or ICMP unreachable but no process is listening. filtered means no response — a firewall is probably dropping packets silently. The distinction between closed and filtered matters: a closed port means the system is reachable but has no services; a filtered port means something is silently discarding packets.Timing templates: -T0 to -T5NMAP offers six timing templates. -T0 (paranoid) sends one packet every 5 minutes, nearly invisible to IDS. -T3 (normal) is the default. -T4 (aggressive) is what I use on local networks and authorized tests. -T5 (insane) is maximum speed and can overwhelm unstable systems. For Docker tests I always use -T4: the network is local, no firewall between scanner and targets. On remote production systems (always with authorization) I use -T2 to avoid overloading legitimate traffic.Docker as an isolated test environmentThe most important decision I made when building the course was using Docker for the test environment. The reason is simple: you don't do port scanning on systems you don't own or don't have explicit authorization for. It's illegal in many jurisdictions and unethical in any context. With Docker I can create an isolated network with multiple containers simulating real services, and scan that network without ever touching the internet. NGINX web server, PostgreSQL database, OpenSSH server — all on the same private Docker network. Free to experiment, zero risk.Scanning Docker containersHost discovery with nmap -sn 172.20.0.0/24, then nmap -A -T4 172.20.0.3 for deep analysis. The -A flag enables OS detection, version detection, script scanning and traceroute together. Docker containers don't filter packets internally, so almost everything is "open" or "closed" — rarely "filtered." In production environments with firewalls I see far more filtered ports.NSE: Nmap Scripting Engine for vulnerability detectionNSE transforms NMAP from a simple port scanner to a vulnerability assessment tool. Hundreds of scripts detect misconfigured services, known CVE versions, dangerous configurations. The smb-vuln-ms17-010 script detects the EternalBlue vulnerability used by WannaCry. On an unpatched Windows system in my test network, NMAP identifies it in seconds. This is the kind of information you want to have before someone else does.Scanning localhost: what you find on your own machineOne of the first things I teach in the course is running a full scan of your own localhost. The results surprise almost everyone: Node.js dev servers on random ports you forgot to stop, MySQL or PostgreSQL listening on 0.0.0.0 instead of 127.0.0.1, IDE services on non-obvious ports, and sometimes Docker daemon with TCP socket accidentally enabled. Regular scanning of your development environment is a security hygiene practice that takes five minutes and can prevent nasty surprises.Ethics and legality of port scanningNMAP is a legitimate and powerful tool, but using it on systems you don't own without explicit authorization is illegal in most countries. Appropriate contexts: your own network and systems, test environments you control (like the Docker lab we build in the course), penetration testing engagements with written authorization, bug bounty programs that explicitly include network scanning in scope. Learn the tool in a safe, controlled environment first — then apply it where you have authorization.