When a port is already in use, I want one command that tells me which program has it. This is the one I would learn first.
Run ss -tulpn. Each letter is a flag from the ss man page: -t shows TCP sockets, -u UDP, -l only listening sockets, -p the processes that use them and -n keeps numbers instead of resolving names. You get a list of ports with the program next to each.
Look for the port you care about, for example ss -tulpn | grep :8080. The last column names the process that holds it, so you know whether to stop it or choose another port for your container.
Caveat: the process column is often empty unless you run it with enough rights, usually with sudo. That is how it behaves on the systems I know, and the man page only says that -p shows the processes. Also remember that a service listening on 127.0.0.1 is only reachable from the machine itself, which is a good thing to notice before you expose something by accident.
Further reading: man7.org: ss(8), On this site: getent hosts shows what your programs really resolve