1. Open nvidia-docker
sudo nvidia-docker run -it -p 7777:8888 tensorflow/tensorflow:latest-gpu
Open jupyter notebook within 2.docker
jupyter notebook --ip 0.0.0.0 --no-browser --allow-root
The first browser to open jupyter notebook
172.28.9.220:7777/tree?token=9Llv9cCqyNv1Vf7g
172.28.9.220 is ip server
7777 is open docker is mapped No.
token token is displayed when docker open jupyter
directly after use to open
172.28.9.220:7777
3. Check the docker is already installed
sudo docker images
View container running
sudo docker ps
Container finish the modifications must be saved
sudo dcoker commit 容器id 容器名
sudo docker commit f55f8ba11f95 tensorflow/tensorflow:latest-gpu
Stop a container
sudo docker stop 容器id
4.docker configuration jupyter notebook
- Create a folder to store jupyter notebook
mkdir [notebook file storage folder]
mkdir jupyter
At this point it is equivalent to creating a jupyter file in the host / home / folder under
3.2 If there is no jupyter notebook in the container, you need to install it
pip install jupyter notebook
3.3 jupyter notebook
Notebook-config --generate jupyter
Vim ~ / .jupyter / jupyter-notebook-config.py
. 1
2
modified following
# 允许root启动
c.NotebookApp.allow_root = True
# 允许远程访问
c.NotebookApp.ip = '0.0.0.0'
# 设置notebook文件夹
c.NotebookApp.notebook_dir = '/jupyter'
# 设置静态token,这样就不用每次换token了,另一种方法是设置密码password
c.NotebookApp.token = '[自定义token]'
3.4 open notebook
jupyter notebook &
press Ctrl + P + Q exits without closing the container
Reproduced in: https: //www.jianshu.com/p/38e5eb3d1e41