1. 环境:linux 环境(基于ubuntu-fork 镜像实现)
2. pip install jupyter notebook
3. 编译jupyterlab源代码必须使用 node 14.21.3 高版本编译报错
#下载 node 14.21.3 :
wget https://nodejs.org/download/release/latest-v14.x/node-v14.21.3-linux-x64.tar.gz
#解压:
tar -zxvf node-v14.21.3-linux-x64.tar.gz
#换目录
mkdir -p ~/.local/share/nodejs
mv ./node-v14.21.3-linux-x64 ~/.local/share/nodejs
cd ~/.local/share/nodejs/node-v14.21.3-linux-x64/
#创建软链接
sudo ln -s ~/.local/share/nodejs/node-v14.21.3-linux-x64/bin/node /usr/bin/
sudo ln -s ~/.local/share/nodejs/node-v14.21.3-linux-x64/bin/npm /usr/bin/
#验证
node -v
npm -v
#npm设置淘宝镜像
npm config set registry https://registry.npm.taobao.org
#验证
npm config get registry
4. (可选)安装中文语言包:pip install jupyterlab-language-pack-zh-CN
5. 生成配置文件:jupyter notebook --generate-config
6. 生成密码:python->from jupyter_server.auth import passwd; passwd()[输入密码] exit()
7. 将6中生成的argon2:$argon……开头的一串密码保存并放入到8中的c.ServerApp.password中
8. 编辑配置文件:5中生成的
c.ServerApp.allow_remote_access = False
c.ServerApp.ip = '0.0.0.0'
c.ServerApp.open_browser = False
c.ServerApp.password = 'argon2:$argon2id$v=19$m=10240,t=10,p=8$nMRDhrNvY8+aYdrK0sY+BQ$/+L6U/Qwv9eKNMQ4xf1vWCLEu5vV4TRokW+4gnkpFH0'
c.ServerApp.port = 8888
9.启动: nohup jupyter lab --allow-root &
Dockerfile
FROM ubuntu:latest
MAINTAINER [email protected]
RUN mkdir /home/jiaohaicheng
ENV MYPATH /home/jiaohaicheng
WORKDIR /home/jiaohaicheng
#COPY requirements.txt .
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \
sudo \
net-tools \
vim \
ffmpeg \
curl \
git \
ntp \
zip \
wget \
&& apt-get clean
RUN echo "set fileencodings=utf-8,gb2312,gbk,gb18030\nset termencoding=utf-8\nset fileformats=unix\nset encoding=prc" >> ~/.vimrc
#RUN sudo apt-get install -y language-pack-zh-hans zh-autoconvert zhcon
#
#RUN echo "LANG='zh_CN.UTF-8'\nLANGUAGE='zh_CN:zh:en_US:en'" >> /etc/environment
#
#RUN echo "en_US.UTF-8 UTF-8\nzh_CN.UTF-8 UTF-8\nzh_CN.GBK GBK\nnzh_CN GB2312" >> /var/lib/locales/supported.d/local
#
#RUN sudo apt-get install -y fonts-droid-fallback ttf-wqy-zenhei ttf-wqy-microhei fonts-arphic-ukai fonts-arphic-uming
#
#RUN echo "LANG=en_US.UTF-8\nLC_CTYPE=en_US.UTF-8" >> /etc/default/locale
#
#RUN sudo locale-gen
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive sudo apt-get -y install \
software-properties-common\
python-is-python3\
python3-pip\
&& apt-get clean
#RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
RUN sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#RUN jupyter notebook --generate-config
CMD /bin/bash
编译报错: