学了一段时间,分享个部署 jupyter notebook

2018-02-03 16:02:54 +08:00
 twotiger

支持 python2, python3.5,可远程访问

创建 doc 文件夹,将 doc 挂载到容器中, 默认密码hello

mkdir doc
FROM ubuntu:latest

# 为 notebook 建立的镜像
RUN apt-get update
RUN apt-get install -y openssh-server vim python python3.5 net-tools python-pip python3-pip
# 必须要升级 pip
RUN pip3 install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -U pip
RUN pip2 install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -U pip
RUN pip2 install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com  ipython==5.5.0 notebook==5.4.0
RUN pip3 install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com notebook==5.4.0


#RUN sed -ri 's/PermitRootLogin.*?/PermitRootLogin yes/g' /etc/ssh/sshd_config
#RUN echo "root:123456" | chpasswd

RUN jupyter notebook --generate-config
RUN mkdir -p /opt/jupyter
RUN sed -i '$a\c.NotebookApp.password = u"sha1:44d5994cc0cd:d6d4104f78a887d14de9624daa05836aa34cc443"\nc.NotebookApp.ip="*"\nc.NotebookApp.allow_root = True\nc.NotebookApp.notebook_dir = u"/opt/jupyter"' /root/.jupyter/jupyter_notebook_config.py

EXPOSE 8888
CMD ["jupyter-notebook"]

创建镜像

创建容器

docker build -t notebook:latest .
docker run  -p 8888:8888 -v $PWD/doc:/opt/jupyter -itd notebook:latest
3347 次点击
所在节点    Docker
6 条回复
defunct9
2018-02-03 18:35:35 +08:00
jupyter 是做什么用的呢
takato
2018-02-03 19:14:13 +08:00
和官方的 image 有什么不同吗?
julyclyde
2018-02-04 08:17:19 +08:00
为什么屁大点事都要弄个 docker ?
twotiger
2018-02-04 09:06:25 +08:00
@julyclyde 那你用 docker 做了什么比屁大点事大的事呢,分享下吧
twotiger
2018-02-04 09:32:48 +08:00
@takato 用国内的源,算么-_-!
julyclyde
2018-02-04 15:04:48 +08:00
@twotiger 我把我们公司客服人员“猫儿盖屎”式的 docker 都解开,用正经打包格式和标准路径的重新部署了应用

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/428219

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX