主要jupyter记录一些笔记和常用命令,这里快速搭建jupyter开发环境
过程
这里直接给出Dockerfile
FROM python:3.6
ENV LANG C.UTF-8
COPY ./jupyter_notebook_config.py /root/.jupyter/jupyter_notebook_config.py
RUN apt-get update -y \
&& ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& pip3 install jupyter -i https://pypi.tuna.tsinghua.edu.cn/simple \
&& echo "Asia/Shanghai" > /etc/timezone \
&& apt-get install tzdata -y \
&& echo "LANG=C.UTF-8" >> /etc/profile \
&& echo "export LANG" >> /etc/profile
CMD ["jupyter", "notebook"]
创建jupyter_notebook_config.py配置文件如下
c.NotebookApp.allow_remote_access = True
c.NotebookApp.allow_root = True
# 允许所有ip
c.NotebookApp.ip = '*'
# 工作目录/root
c.NotebookApp.notebook_dir = '/root'
# 在服务端禁用浏览器
c.NotebookApp.open_browser = False
# 密码明文为123456
c.NotebookApp.password = 'sha1:008b8890dce9:c3c635707ae9f58ddbc63c64c39dbce0a43aecd3'
c.NotebookApp.port = 8888
将jupyter_notebook_config.py和Dockerfile放在同级目录下
docker build -t jupyter-dev:1.0 .
运行容器
docker run --name jupyter -d -p 8889:8888 jupyter-dev:1.0
在浏览器中访问http://
直接运行dockerhub中镜像
docker run --name jupyter -d -p 8889:8888 onefeng/jupyter-dev:1.0