ยง2023-08-13

  1. start with this Dockerfile
# https://github.com/jupyterhub/jupyterhub/blob/main/Dockerfile
FROM jupyterhub/jupyterhub:latest as builder

EXPOSE 8000

LABEL maintainer="alexlai@munetaka.me"

CMD ["jupyterhub"]
#
# Notes
# 
# sudo docker build --tag jupyterhub:ubuntu_x86_64 (--no-cache) ./
# sudo docker run -it jupyterhub:ubuntu_x86_64 /bin/bash
# sudo docker run -d -p 42100:8000 --mount type=bind,source=/volume1/JupyterHub,target=/home/alexlai/JupyterHub --name jupyterhub jupyterhub:ubuntu_x86_64 jupyterhub
#                       outside-port:inside-port
# docker ps
# docker stop (NAMES)
# docker rm  (NAMES)
#
$ docker build --tag jupyterhub:ubuntu_x86_64 ./
alexlai@h2Jammy:~/docker-proj/jupyterHub/ubuntu$ docker run -it jupyterhub:ubuntu_x86_64 /bin/bash
root@b9a9b8e0e49e:/srv/jupyterhub# ls /
bin  boot  dev  etc  home  lib  lib32  lib64  libx32  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
root@b9a9b8e0e49e:/srv/jupyterhub# which jupyterhub
/usr/local/bin/jupyterhub
root@b9a9b8e0e49e:/srv/jupyterhub# jupyterhub
root@23182ea378b5:/srv/jupyterhub# uname -a
Linux 23182ea378b5 5.15.0-78-generic #85-Ubuntu SMP Fri Jul 7 15:25:09 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
root@23182ea378b5:/srv/jupyterhub# cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.2 LTS"
$ docker run -d -p 42100:8000 --name jupyterhub jupyterhub:ubuntu_x86_64 jupyterhub
$ docker stop jupyterhub
jupyterhub
alexlai@h2Jammy:~/docker-proj/jupyterHub/ubuntu$ docker rm jupyterhub
jupyterhub

jupyter-latest.png



Ask chatGPT

This is the Dockerfile

# https://github.com/jupyterhub/jupyterhub/blob/main/Dockerfile
FROM jupyterhub/jupyterhub:latest as builder

EXPOSE 8000

LABEL maintainer="alexlai@munetaka.me"

CMD ["jupyterhub"]
#
# Notes
# 
# sudo docker build --tag jupyterhub:ubuntu_x86_64 (--no-cache) ./
# sudo docker run -it jupyterhub:ubuntu_x86_64 /bin/bash
# sudo docker run -d -p 42100:8000 --mount type=bind,source=/volume1/JupyterHub,target=/home/alexlai/JupyterHub --name jupyterhub jupyterhub:ubuntu_x86_64 jupyterhub
#                       outside-port:inside-port
# docker ps
# docker stop (NAMES)
# docker rm  (NAMES)
#

And

Buillt wiht

$ docker build --tag jupyterhub:ubuntu_x86_64 ./

And Run with

$ docker run -d -p 42100:8000 --name jupyterhub jupyterhub:ubuntu_x86_64 jupyterhub

Try to login jupyterhub,http://h2jammy.yushei.net:42100/hub/spawn-pending/alexlai

Get this error

Spawn failed: Server at http://127.0.0.1:52451/user/alexlai/ didn't respond in 30 seconds


``bash [+] Building 1012.9s (9/10) docker:default => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 1.45kB 0.0s => [internal] load metadata for docker.io/library/ubuntu:jammy 1.7s => CACHED [1/7] FROM docker.io/library/ubuntu:jammy@sha256:0bced47fffa3361afa981854fcabcd4577cd43cebbb808cea2b1f33a3dd7f508 0.0s => [2/7] RUN useradd -m -d /home/alexlai -s /bin/bash -G sudo -u 1026 alexlai && echo 'alexlai:alex1765' | chpasswd 0.5s => [3/7] RUN apt update && apt -y upgrade && apt install -y wget && wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp 49.5s => [4/7] RUN conda install conda=23.7.2 21.3s => [5/7] RUN conda create -n myenv python=3.10 32.0s => [6/7] RUN echo "conda activate myenv" >> ~/.bashrc 0.5s => [7/7] RUN /bin/bash -c "source activate myenv && conda install -c conda-forge jupyterhub jupyterlab notebook jupyter_core && conda clean -afy" 907.3s => => # Collecting package metadata (current_repodata.json): ...working... done
=> => # Solving environment: ...working... unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
=> => # Solving environment: ...working... done
=> => # Collecting package metadata (repodata.json): ...working... done
=> => # Solving environment: ...working... <--- take a long time