支持 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
1
defunct9 2018-02-03 18:35:35 +08:00 via iPhone
jupyter 是做什么用的呢
|
2
takato 2018-02-03 19:14:13 +08:00 via iPhone
和官方的 image 有什么不同吗?
|
3
julyclyde 2018-02-04 08:17:19 +08:00
为什么屁大点事都要弄个 docker ?
|