参考:
https://www.jianshu.com/p/fce000cf4c0f
前提:
nvidia-docker cuda
镜像
$ nvidia-docker run -it -p 8888:8888 tensorflow/tensorflow:latest-gpu
##持久
nvidia-docker run -e PASSWORD=your_jupyter_passwd \ # set password
-d \ # run as daemon
-p 8888:8888 \ # port binding
--name tensorflow \
-v /data/dir/on/host/:/data/ \ # bind data volume
tensorflow/tensorflow:latest-gpu
接上:
修改Jupyter默认启动的terminal所使用的shell
使用的镜像的主进程是Jupyter,修改Jupyter默认启动terminal所使用的shell,最简单的方法是在此脚本中设置SHELL环境变量。通过Jupyter启动terminal或者是docker exec -it tensorflow bash的方法进入容器,然后编辑/run_jupyter.sh,在jupyer notebook "$@"之前添加
export SHELL=/bin/bash
使用anaconda
##1,在容器内安装Anaconda
##2,编辑/run_jupyter.sh
jupyter notebook "$@" 改为:/path/to/anaconda/bin/jupyter notebook "$@"