-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
Our applications register themselves with service discovery upon startup. Currently, we have to statically define the port bindings on docker run via -p 1234:45000 and then provide the port via an environment variable (-e HOST_PORT:45000) so the app can correctly register itself correctly.
It would be helpful to have that environment variable exposed inside the container automatically to indicate which port docker has selected for our container so we can rely on docker port allocation instead of having to rewrite port allocation as part of a tool external to docker.
It's likely that a container binds to many ports, so the envvars exposed should follow a scheme similar to how container link envvars are generated. In the above example (-p 1234:45000), the env var generated would be something like HOST_PORT_1234.