I want to use jupyterhub/jupyterhub to start a container running jupyterhub.
So I create a Dockerfile:
FROM jupyterhub/jupyterhub
RUN useradd -m test && \
echo "test:password" | chpasswd
And using docker build -t jupyterhub_test:3 .
to build a image with user test and password password.
However, when I start the container using docker run -itp 8080:8000 jupyterhub_test:3
I could log in in the host machine with hostmachine_ip:8080; but there is the error saids "No module named jupyter_core"
And I search for the solution, someone suggest to install notebook in Dockerfile and I tried, it works, but when I log in, I was in jupyterlab instead of jupyterhub interface.
So here comes two question:
1 How could I login into the jupyterhub instead of jupyterlab?
2 As an official docker hub, how come jupyterhub/jupyterhub image didn't work until I installed some other module, are there some things I didn't make correct? I suppose I should get a container immediately worked based on this image.
Addition: I thought this is what the jupyterhub like:
May be the answer by @datawookie is also jupyterhub page
or the one I used before is jupyterhub + jupyter notebook while the answer is jupyterhub + jupyterlab
or just the one I used is an old version.
You need to install a couple of packages. I suggest creating a requirements.txt
file:
jupyterlab==4.1.8
notebook==7.1.3
Then update your Dockerfile
.
FROM jupyterhub/jupyterhub:4.1.5
RUN useradd -m test && \
echo "test:password" | chpasswd
COPY requirements.txt .
RUN pip install -r requirements.txt
Now build and run.
docker build -t jupyterhub-user . && docker run -it -p 8000:8000 jupyterhub-user
How could I login into the jupyterhub instead of jupyterlab?
With this setup you go to 127.0.0.1:8000 and login to JuypterHub.
As an official docker hub, how come jupyterhub/jupyterhub image didn't work until I installed some other module, are there some things I didn't make correct?
The image overview mentions that you need to install these packages. Docker images are often fairly minimal. The base image serves DockerHub but if you want to launch something else then you need to add functionality. This helps to avoid bloating the base image with things that not everybody might need.
When you login using the credentials specified in the Dockerfile
you'll get a JupyterLab instance.