Docker 上跑 Jupyter 还带GPU
首先安好 nvidia-docker 才能看到GPU
# root用户才可以分配GPU
sudo docker run -it --rm --name jupyter -p 0.0.0.0:8888:8888 --gpus all -v /home/ubuntu/jupyter-workspace:/home/jovyan -v/home/ubuntu/rqalpha-plus-workspace/bundle:/home/jovyan/rqdata:ro jupyter/datascience-notebook
# jupyter镜像默认不允许远程访问
sudo docker exec -it jupyter bash
echo "c.NotebookApp.ip = '*'" >> .jupyter/jupyter_notebook_config.py
# 安装pytorch with cuda11.6
conda install pytorch torchvision torchaudio cudatoolkit=11.6 -c pytorch -c conda-forge
# 显示TOKEN
sudo docker exec jupyter jupyter server list
# REMOTE IP
http://xxx.xxx.xxx.xxx:8888/
出处:http://tugeler.cnblogs.com/
本文版权归作者所,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。