LinuxJunior
Address already in use (port is taken)
A program can't bind its port because another process already listens on it. Use ss to find the owner, then stop it or move your service.
What you see
Address already in usewhen a server starts (the exact wording differs by program)
What it means
Only one process can listen on a given address and port. If something else already holds it, a second one cannot bind. Often it is an older copy of the same program.
How to confirm the cause
- 1Find the process listening on the port
sudo ss -ltnp | grep ':8080'
-llistening,-tTCP,-nnumeric ports,-pshow the owning process. Replace 8080 with your port. You need root to see processes you do not own.
Causes and fixes
An old instance of the same program is still running
- HOW TO TELL
- The process shown by
ssis your own application. - FIX
- Stop the old instance properly, then start the new one.
A different program uses that port
- HOW TO TELL
ssshows a different process name.- FIX
- Stop that program, or change the port in one of the two configurations.
A container publishes the port
- HOW TO TELL
- The owner is a container proxy or the runtime.
- FIX
- Find the container publishing it with
docker ps, then stop or remap it.
How to stop it coming back
- Let the service manager start and stop the program so duplicates are not left behind.
- Keep a list of which service owns which port.
Keep going
- Runbook: A systemd service failed to start
- Cheat sheet: ss
- Cheat sheet: netstat
- Lesson: the networking topic in Learn
Sources
Linux man-pages (man7.org) and the systemd manual (freedesktop.org), read 18 Nov 2026. Command options were checked against those pages.