1. 查看CUDA版本
cat /usr/local/cuda/version.txt
2. 查看cudnn版本
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
下图中6为版本
Pull Docker image
1. 拉
docker pull nvidia/cuda:11.1-cudnn8-devel-ubuntu18.04
2. 查
docker images
3. 启动(添加端口映射)
sudo docker run -it --name algorithm -v /data/algorithm:/data/algorithm -p 8080:22 --runtime=nvidia -e NVIDIA_VISIBLE_DEVICE=all nvidia/cuda:11.1-cudnn8-devel-ubuntu18.04
进入镜像
docker exec -it algorithm /bin/bash
不停止 退出镜像
ctrl p + ctrl q
测试显卡驱动
nvidia-smi
apt-get update
apt-get install sudo
问题二
pip更新为清华源
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
问题三
安装opencv
首先更换清华源
之后:
apt-get update && apt-get install -y python3-opencv
问题四 安装git
sudo apt-get install git
问题五 安装vim
sudo apt-get install vim-gtk
清华源(Ubuntu 18.04)
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
1. 更新容器的apt源,安装ssh和vim
apt-get update
apt-get install openssh-server
apt-get install vim
2. 使用vim打开并修改配置文件,找到PermitRootLogin prohibit-password这一行,修改为PermitRootLogin yes,允许通过ssh远程访问docker。
vim /etc/ssh/sshd_config
3. 创建docker中root用户的密码。
passwd root
4. 启动ssh服务,至此,服务器端配置完毕。
service ssh restart
vim全部删除:按esc后,然后dG
全选(高亮显示):按esc后,然后ggvG或者ggVG