Hi everyone! I'm just starting out with Docker and I've noticed that many projects seem to default to running on ports 8000 or 8080. I'm curious about a couple of things: why don't developers opt for completely random, unused ports? Also, is there any way to run different services on the same port? And if that's not possible, is there a tool that could help manage port assignments, much like a doorman that says which port to use?
1 Answer
Docker also lets you specify the ports externally when deploying your containers. You can run your service on port 8080 inside the container but map it to any open port outside the container like 8081 or 8082 by using the `-p` option when starting it. This keeps your workflow pretty flexible without worrying about conflicts!
That’s exactly what I needed to know, thanks!