Docker 部署Jupyter book


1、#拉取镜像

docker pull jupyter/base-notebook

2、#创建挂载目录

mkdir -p /opt/jupyter/book
chmod 777 /opt/jupyter/book

3、#运行实例

docker run --name my-jupyter -d \
-p 8118:8888 \
-v /opt/jupyter/book:/home/jovyan \
jupyter/base-notebook

4、#访问地址(发现需要token)

http://hadoop101:8118

5、#查询token(执行下面命令后?token=后面的就是token值)

docker exec -it my-jupyter jupyter notebook list

http://0.0.0.0:8888/?token=f45518e5acc852a3e69a202a787fe2015542b14a0f6b8063

5、#设置密码

docker exec -it my-jupyter jupyter notebook password

6、#重启实例

docker restart my-jupyter

#再次访问,输入密码即可登录
#配置信息和保存的文件都在 “/opt/jupyter/book” 下

7、测试

1、安装numpy和pandas
pip install numpy 和 pip install pandas

2、执行

import pandas as pd
import numpy as np
 
dates = pd.date_range('20210101', periods=7) # 生成作为行索引的时间序列
#print(dates)
#print("--"*16)
# 使用随机生成的 numpy 数组作为数据,传入列索引 ABCD
df = pd.DataFrame(np.random.randn(7,4), index=dates, columns=list('ABCD')) 
df


TRANSLATE with x English
Arabic Hebrew Polish
Bulgarian Hindi Portuguese
Catalan Hmong Daw Romanian
Chinese Simplified Hungarian Russian
Chinese Traditional Indonesian Slovak
Czech Italian Slovenian
Danish Japanese Spanish
Dutch Klingon Swedish
English Korean Thai
Estonian Latvian Turkish
Finnish Lithuanian Ukrainian
French Malay Urdu
German Maltese Vietnamese
Greek Norwegian Welsh
Haitian Creole Persian  
Bing Webmaster Portal Back