Why Do So Many Docker Containers Use Ports 8000 or 8080?

0
0
Asked By CloudyPineapple83 On

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

Answered By TechSavvyAlex On

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!

DockerDebbie -

That’s exactly what I needed to know, thanks!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.