1 从容器中pull 镜像
docker 容器中 jupyter notebook 的镜像是jupyter/scipy-notebook
docker pull jupyter/scipy-notebook
2 运行 jupyter/scipy-notebook镜像
docker run --name=jupyter -p 8888:8888 -d --network nebula-net jupyter/scipy-notebook
这样子的话也能打开jupyter notebook ,用localhost:8888打开
但需要你登录,这样子我感觉挺麻烦的,
我没有登录过,感觉有点奇怪,看了一堆博客关于如何配置登录文件进行登录的,都没看懂和操作懂,。后来找到了这个 [Docker 安装 Jupyter Notebook]发现原来是没有进行数据挂载。
3 在运行jupyter notebook 的同时进行数据挂载
docker run -it --network nebula-net -p 8888:8888 -v /home/hhl/notebook:/home/notebook/data 413bbbdc3784
-p暴露端口,
-v 数据挂载
–network 之前create 的网络 nebula-net
/home/hhl/notebook我的宿主机存放notebook的文件夹
home/notebook/data 容器中运行jupyter notebook的 位置,运行成功
容器运行jupyter notebook 没有在浏览器中直接打开 ,复制连接打开
http://127.0.0.1:8888/?token=6000a38c7bd5d4f08f8d4e0fd6eaa6af605c4a169f98a291
这里就跟之前主机运行jupyter notebook一模一样了