lmenezes / cerebro-docker

official cerebro docker image
118 stars 40 forks source link

Support exposed port as environment variable #4

Closed matthew-gill closed 4 years ago

matthew-gill commented 4 years ago

Hey! Thanks for this project, very useful - I'll be moving over from Kopf soon.

I'm currently setting up preview environment for my PRs, where each environment has it's own copy of elasticsearch etc. I'm currently getting some port clashes with the other services within my stack.

I see on the Cerebro config you can specify something like http.port=1234 to change the exposed port.

I'm wondering if it would be possible to update the Dockerfile to allow us to set the port as an environment variable? I can have a go raising a PR some point soon, just wondered if anything was in the works?

moliware commented 4 years ago

Hi!

I'm not sure if I understood, if you have port clashes in your docker host you can run something like:

docker run -p 9005:9000 lmenezes/cerebro

So that you can access cerebro in http://your_docker_host:9005

If you want to run and expose the incoming port different than 9000, I guess you can do it in the docker run command https://docs.docker.com/engine/reference/run/#expose-incoming-ports.

matthew-gill commented 4 years ago

thanks for the reply @moliware I know it's possible when running docker like this, however, within a kubernetes cluster you cannot map ports like this unfortunately.

All containers within a pod must only ever use distinct ports, and k8s doesn't support port mappings.

matthew-gill commented 4 years ago

Thanks for the prompt @moliware , I raised a PR here

moliware commented 4 years ago

PR merged! Thank you!