wsl2安装docker,cuda和cudnn镜像

 输入指令:curl https://get.docker.com | sh

输入之后需要等待20s,安装完成后docker version查看docker版本

启动docker:sudo service docker start

关闭docker:sudo service docker stop

cuda的docker镜像网站,可根据自己的需要选择:nvidia/cuda Tags | Docker Hub

选择devel版本的 例如:11.1.1-cudnn8-devel-ubuntu20.04

安装过程中报错:需要将用户添加到组中

sudo groupadd docker   # 添加用户组
sudo gpasswd -a usename docker # 将当前用户添加至用户组中 usename改成自己的名字
newgrp docker         # 更新用户组

 从镜像创建容器:

docker run -id -v ~/work:/work --name=自己的容器的名字 --gpus all 镜像名称

# 运行完上一步会得到一个xxxid 
docker exec -it xxxid /bin/bash

docker运行的一些指令:

# 查看镜像
docker images

# 查看运行的容器
docker ps -a

# 关闭指定的容器
docker kill 容器id

# 保存自己的容器为镜像
docker commit 容器id name:tag

# 保存镜像为本地压缩文件,docker save时报错permission denied
docker save -o 保存绝对路径 镜像id

# 读取本地镜像
docker load --input youriamges.tar

在容器中安装python和pip

当python和pip对应不上时参考:Ubuntu安装python3.8的pip_python3.8对应的pip版本_爱你'非我莫属。的博客-CSDN博客

# 安装python
apt install python3.9

# 软连接
ln -s /usr/bin/python3.9 /usr/bin/python

# 报错时更新apt
sudo apt-get update

# 安装pip包
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.9 get-pip.py  # 想要将python哪个版本和pip连接就输入python的对应版本,此处为3.9

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值