I don't have much practical experience with containers, yet I see a lot of people using alternative ports to deploy their services. As a consequence, here's a very basic question: Is there a good reason why in docker containers we should avoid standard TCP/UDP ports?
Popular examples for such ports are 80 for HTTP, 21 for FTP, 443 for HTTPS, 22 for SSH, etc. Often these are substituted with ports like 8080 or 3000 for 80, 8443 for 443, 1022 for 22,...
There are good reasons to do these substitutions in general:
- Ports under 1024 are reserved to system processes thus accessible only to the root user.
- These system ports are often avoided in development in order to prevent conflicts with other services that might be possibly running.
- Sometimes such alternative ports are used as a way to achieve a level of security-by-obscurity.
However, to me it seems that the isolated nature of containers predisposes that standard ports are used. This could lead to some benefits, such as easier development and testing due to to default configurations.