R
RunPod10mo ago
Jack

How to enable Jupyter Notebook and SSH support in a custom Docker container?

I built my own docker image to deploy on a pod. After creating the Custom Template with my docker image, there is no option to enable Jupyter Notebook or SSH for it. I tried my best to imitate the official Runpod containers, by installing jupyterlabs and openssh-server, but when setting up the pod, there is still no option to enable Jupyter Notebooks or SSH on the pod. I am also not able to find any guides on how to incorporate Jupyter notebook support on a custom docker image. How do I do it?
10 Replies
Madiator2011
Madiator201110mo ago
GitHub
containers/container-template/start.sh at main · runpod/containers
🐳 | Dockerfiles for the RunPod container images used for our official templates. - runpod/containers
Jack
Jack10mo ago
Thanks. If I only wanted to enable jupyterlabs, can I just copy over the start_jupyter() and execute it in start.sh? Do I need to copy over the other functions like start_nginx(), execute_script(), export_env_vars?
Madiator2011
Madiator201110mo ago
I would include it all
Jack
Jack10mo ago
Well I copied over as much as the code as possible. And there is still no option to enable jupyter/ssh, darn it.
No description
Madiator2011
Madiator201110mo ago
you do not need to check anything here just epose port 8888 in http section
Jack
Jack10mo ago
Can you elaborate on this? What http section?
Madiator2011
Madiator201110mo ago
when you edit your template
No description
Jack
Jack10mo ago
Is the "connect to jupyter" option supposed to show up at the "Connect" popup if I did things right?
No description
Madiator2011
Madiator201110mo ago
if you added it correct
justin
justin10mo ago
Do u have a particular CMD command u must override or something? If not u can just use a runpod pytorch template and not override the cmd / entry point and it will just work Someone by using the runpod template as the base was also able to just append the following to their start command along with whatever else they wanted https://discord.com/channels/912829806415085598/1194695853026328626/1194759592865955952 “Actually someone had also recommended you can do this in your CMD, since they had issue finding the start.sh script.
bash -c "apt update;apt install -y wget;DEBIAN_FRONTEND=noninteractive apt-get install openssh-server -y;mkdir -p ~/.ssh;cd $_;chmod 700 ~/.ssh;echo $PUBLIC_KEY > authorized_keys;chmod 700 authorized_keys;service ssh start;sleep infinity"
bash -c "apt update;apt install -y wget;DEBIAN_FRONTEND=noninteractive apt-get install openssh-server -y;mkdir -p ~/.ssh;cd $_;chmod 700 ~/.ssh;echo $PUBLIC_KEY > authorized_keys;chmod 700 authorized_keys;service ssh start;sleep infinity"
So you could as your start CMD command start up whatever command you want + also do this bash command. maybe have a bash script for startup execute the above + your own thing.“
Want results from more Discord servers?
Add your server