diff --git a/Jupyter Lab/Alpine-NonRoot/Dockerfile b/Jupyter Lab/Alpine-NonRoot/Dockerfile new file mode 100644 index 0000000..e03f735 --- /dev/null +++ b/Jupyter Lab/Alpine-NonRoot/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3-alpine + +LABEL maintainer="" +LABEL version="selfbuilt" + +WORKDIR /jupyter +RUN \ + sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories &&\ + apk add --no-cache libc-dev libffi-dev gcc sudo && \ + pip install -i https://pypi.tuna.tsinghua.edu.cn/simple jupyterlab --no-cache-dir && \ + apk del libc-dev libffi-dev gcc +RUN \ + addgroup notebook &&\ + adduser -Ss /bin/bash -g notebook notebook &&\ + adduser notebook sudo &&\ + echo "notebook:123456" | chpasswd &&\ + chown -R notebook:notebook . &&\ + mkdir /data &&\ + chown -R notebook:notebook /data + +EXPOSE 8888 +USER notebook +CMD ["jupyter", "lab", "--no-browser", "--ip", "\"0.0.0.0\"", "--port", "8888", "--allow-root"] \ No newline at end of file diff --git a/Jupyter Lab/Dockerfile b/Jupyter Lab/Ubuntu2204-NonRoot/Dockerfile similarity index 82% rename from Jupyter Lab/Dockerfile rename to Jupyter Lab/Ubuntu2204-NonRoot/Dockerfile index bad6d00..d16948d 100644 --- a/Jupyter Lab/Dockerfile +++ b/Jupyter Lab/Ubuntu2204-NonRoot/Dockerfile @@ -8,8 +8,9 @@ RUN cp /etc/apt/sources.list /etc/apt/sources.list.ori && \ groupadd notebook &&\ useradd -m -s /bin/bash -G notebook notebooks &&\ usermod -aG sudo notebooks &&\ + echo 'notebooks:123456' | chpasswd &&\ chown -R notebooks:notebook /jupyter -RUN apt update && apt install -y python3 python3-pip +RUN apt update && apt install -y python3 python3-pip sudo RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple jupyterlab EXPOSE 8888 diff --git a/README b/README index 6302e4b..d244677 100644 --- a/README +++ b/README @@ -13,7 +13,8 @@ docker run -itd --name jupyter -p 8888:8888 -v /path/to/save:/jupyter /j Version ------ Jupyter Lab: - - / : Jupyter Lab servers built on Ubuntu, run as non-root users. + - /Alpine-NonRoot : Jupyter Lab server built on Alpine Linux, running with non-root users (`notebook`), this build is relatively secure. + - /Ubuntu2204-NonRoot : Jupyter Lab server built on Ubuntu 22.04, running with non-root users (`notebook`), this build is relatively secure. Jupyter Notebook: - /Alpine-NonRoot : Jupyter Notebook server built on Alpine Linux, running with non-root users (`notebook`), this build is relatively secure. - /Alpine-Root : Jupyter Notebook server built on Alpine Linux, running as Root user, this build is recommended only for testing or learning environments deployed on an Intranet. \ No newline at end of file