Support specifying listening port of spawned image
t-moe opened this issue · 6 comments
It looks like currently the container I launch has to listen on port 8080 for incoming connections. It would be nice if the API (DockerExecutableConfig) supported specifiying a different port.
I take it the use case here is to be able to run pre-existing containers without having to rebuild them for Plane?
I've started working on this on #281, but I'll need to test a bit more.
I take it the use case here is to be able to run pre-existing containers without having to rebuild them for Plane?
Yes, exactly. Our existing container runs on a different port, unless we modify that behavior via Environment Variable.
(I hacked the environment variables needed into cli/src/main.rs
to get it running).
I've started working on this on #281, but I'll need to test a bit more.
Awesome!
Ah, if the container already allows passing the port as an environment variable, we could also support environment variables on the command line.
e.g. plane-cli spawn my-container -e MY_PORT=9999
Would that work for your use case as well?
Yes, that would work.
But I think in the long run it would be nice if plane-cli spawn
supports specifying all details from the DockerExecutableConfig
(including port).
For now I'm spawning containers via nats API from my nodejs app, so no need to hurry with the cli....
Whether to expose all Spawn options through the CLI has been subject of some debate internally, because we don't want the CLI to become overwhelming with the additional things we have on the roadmap. Port and env vars both seem pretty useful, though, I think we could target those.