sclorg / s2i-nodejs-container

NodeJS images based on Red Hat Software Collections and intended for OpenShift and general usage, that provide a platform for building and running NodeJS applications. Users can choose between Red Hat Enterprise Linux, Fedora, and CentOS based images.
http://softwarecollections.org
Apache License 2.0
165 stars 287 forks source link

Don't expose port 8080 by default #199

Open mcandre opened 5 years ago

mcandre commented 5 years ago

Many Node.js applications use a different port (e.g., React.js assumes 3000), or even avoid using networking altogether (e.g., Node.js CLI tools). I think the benefits of assigning a default port mapping are slim compared to the downsides of collision for different kinds of Node.js project configurations.

One workaround for downstream images is to reconfigure applications to match port 8080. Another workaround is to open up both 8080 and the other ports (unfortunately, Docker does not currently have a way to un-EXPOSE ports). Ultimately, it would be cleaner to not assume any particular network port configuration and leave that up to downstream developers to decide.

der-ali commented 5 years ago

i had also this problem. I set therefore an env in the app to configure the port. Openshift exposes port 8080 as a default port for the routes.

ryanj commented 3 years ago

Try using the PORT env var. You should be able to set PORT=3000

phracek commented 1 year ago

@mcandre @der-ali After setting PORT env var, is the container working properly? If so, please close this issue.