Is it possible for JupyterHub dockerspawner to expose more than 1 port on the instance

User docker spawner user has his own container spun when accessing Jupyter Notebook. He is hosting a service on his env which I want to make available on Instance IP on which the JupyterHub server is running. Is this possible?
network_mode = host not working as unable to bind multiple containers for users.


I’m afraid it’s not entirely clear what you wish to do. For example,

He is hosting a service on his env

Where is this “env”, what kind of service is it, how is it managed? Who should the service be exposed to, just the user, or everyone?

GitHub - jupyterhub/jupyter-server-proxy: Jupyter notebook server extension to proxy web services. may be useful to you, if you give us more information and some examples that would be helpful.

Hi @manics, thanks for your reply. here is more information on the issue:
JupyterHub is hosted in cloud VM and in config we are using docker Spawner.
Docker Swapner spins up a container notebook for each user so for example if I start a tensorboard on port 6002 from my notebook terminal, it will be running inside container localhost:6000 and not on VM_IP:6000
I want to open container port 6000 so that it can be available on VM IP. One more issue is that the container port is not fixed it can be any port which may be available on Instance. Hence wanted to know if any configurations can be done to expose the ports from JupyterHub config file

You may find this explanation of serving up python -m http.server (which by default serves on localhost:8000) from within a hub useful, I wrote it with help from @yuvipanda for a class where a similar need arose.