Centos7升级安装docker19.03,并使用GPU

1.停止运行的docker服务

systemctl stop docker

2.卸载旧版本docker

yum remove docker docker-client docker-client-latest 
yum remove docker-common docker-latest docker-latest-logrotate 
yum remove docker-logrotate docker-selinux docker-engine-selinux docker-engine

3.安装基础软件

yum -y install yum-utils device-mapper-persistent-data lvm2

4.配置YUM镜像仓库

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

5.查询并安装指定版本

#查询docker版本
yum list docker-ce --showduplicates|sort -r
#安装指定版本
yum install docker-ce-19.03.9 -y

6.安装nvidia-container-toolkit

distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo | sudo tee /etc/yum.repos.d/nvidia-docker.repo
yum install -y nvidia-container-toolkit

7.启动并设置开机自启动

systemctl start docker
systemctl enable docker

8.测试GPU

docker run --gpus all XXXXXX(docker image) nvidia-smi

9.指定GPU

docker run --gpus "devices=1" XXXXXX(docker image) nvidia-smi

参考:https://www.cnblogs.com/wangzy-tongq/p/13273122.html

你可能感兴趣的:(Centos7升级安装docker19.03,并使用GPU)