前言

近期在打深度学习的基础,部分教程系列使用jupyter notebook来敲代码,更为直观。本篇用来总结Docker内jupyter notebook的安装与使用。

一、安装Jupyter notebook(已完成可忽略)

  1. 默认已经到docker环境内,第一步进行Jupyter notebook的安装
pip install jupyter notebook
#pip3 install jupyter notebook
#如果安装太慢,可以自行去换源

注意:在从docker hub拉取的官方的pytorch镜像中,其内部使用的是conda。则安装jupyter notebook如下:

conda install jupyter notebook
#如果安装太慢,可以自行去换源

二、启用jupyter notebook

在docker镜像内输入:

jupyter notebook --allow-root

若返回如下,则启动成功。

   
    To access the notebook, open this file in a browser:
        file:///root/.local/share/jupyter/runtime/nbserver-32550-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=67a61147f83795813f31c3b53cd2ec47d03250ecc9518913
     or http://127.0.0.1:8888/?token=67a61147f83795813f31c3b53cd2ec47d03250ecc9518913

根据英文意思,Copy一个URLs到自带的浏览器及可成功进入jupyter notebook。
如下所示:

0

总结

本方法较为简单,但仅支持本地Dokcer的jupyter notebook的本地连接,未在同一局域网或远程端测试。

若需远程连接,可以参考docker容器下配置jupyter notebook这个博主。

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐