Port errors from already-in-use ports are the most common and annoying thing. First, check what's using the ports: on Windows/WSL2 run `netstat -ano | findstr :5432` (or whatever port you're using) to see which process has it. If it's another container that got stuck, kill the container with `docker rm -f container_name`. The permissions issue usually comes from WSL2 trying to mount volumes without the right permissions on Windows, so in your `docker-compose.yml` explicitly specify the ports and don't use complicated bind mounts at first; better to copy the code into the image or use named volumes that Docker handles better.
For your Node + PostgreSQL setup, the cleanest approach is a `docker-compose.yml` where you define the services without overcomplicating things. Map different ports if something's already using the standard ones (e.g. `5433:5432` for Postgres), make sure your Node can resolve the database container's hostname (use the service name in docker-compose, like `postgres:5432`), and restart everything clean: `docker-compose down -v` kills the containers and volumes, then `docker-compose up`. Watch out for named volumes vs bind mounts on WSL2; bind mounts sometimes act weird with permissions, so for local development just consider not mounting the code if you don't need to, or use named volumes that WSL2 handles better.
The part most people skip: check the logs. `docker-compose logs -f` shows you what's happening inside in real time; there you see if the app actually connects, if the database is ready, everything. And one thing that saves a ton of hours, especially on Windows: sometimes WSL2 and Docker have weird conflicts, so if it's still a mess, try Docker Desktop directly (not WSL2) or make sure your WSL2 version is up to date. Most people who ditch Docker on Windows do it because they don't update WSL2 or mix up their configs.