前置:Docker、Docker-Compose的安装以及相关使用
version: ‘3.1‘
services:
anaconda:
restart: always
image: continuumio/anaconda3
container_name: anaconda
ports:
- 8888:8888
environment:
TZ: Asia/Shanghai
command: /bin/bash -c "mkdir -p /mnt/app &&./mnt/app/entrypoint.sh"
volumes:
- ./app:/mnt/app
mkdir ./app
entrypoint.sh
#!/bin/bash
echo y|conda install -c conda-forge jupyterlab
echo y|jupyter notebook --generate-config
sha1=`python3 /mnt/app/setPwd.py`
echo $sha1
echo "c.NotebookApp.ip=‘*‘ #绑定所有地址,即所有IP 地址都可以访问" >> /root/.jupyter/jupyter_notebook_config.py
echo "c.NotebookApp.password = u‘$sha1‘" >> /root/.jupyter/jupyter_notebook_config.py
echo "c.NotebookApp.open_browser = False #启动后是否在浏览器中自动打开" >> /root/.jupyter/jupyter_notebook_config.py
echo "c.NotebookApp.port =8888 #指定一个访问端口默认8888" >> /root/.jupyter/jupyter_notebook_config.py
echo "c.NotebookApp.allow_remote = True #将远程访问设置成True" >> /root/.jupyter/jupyter_notebook_config.py
pip --default-timeout=100 install -U jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
pip --default-timeout=100 install -U jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable --user
jupyter notebook --allow-root
setPwd.py
from notebook.auth import passwd
# 密码:12345
print(passwd("12345","sha1"))
docker-compose up -d
点击Nbextensions选项卡勾选Hinterland,使用Jupyter敲几行代码试试,终于摆脱每次按tab键的烦恼了
原文:https://www.cnblogs.com/zzxaaas/p/14769516.html