CloudFoundry官方文档说的很清楚: https://docs.cloudfoundry.org/devguide/custom-ports.html
By default, apps only receive requests on port 8080 for both HTTP and TCP routing, and so must be configured, or hard coded, to listen on this port. 在CloudFoundry上,默认的HTTP和TCP路由端口为8080.
使用8080之外的端口的场景:
Configuring custom app ports allows developers to bring workloads onto Cloud Foundry that listen on ports other than 8080. Here are some example use cases:
首先要搞清楚CloudFoundry环境下的三种端口:
这个端口是应用运行的容器监听的端口,和容器内运行应用监听的端口是一一映射关系。