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/

posted @ 2022-10-06 22:57  LightingCui  阅读(128)  评论(0编辑  收藏  举报