1. 程式人生 > >Nvidia-docker安裝

Nvidia-docker安裝

  • 首先按照下面的命令新增package repositories

# Add the package repositories
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \
  sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu16.04/amd64/nvidia-docker.list | \
  sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update

# Install nvidia-docker2 and reload the Docker daemon configuration
sudo apt-get install -y nvidia-docker2 sudo pkill -SIGHUP dockerd # Test nvidia-smi with the latest official CUDA image docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi
  • 然後我們通過
sudo apt-get install -y nvidia-docker2

該命令可以發現我們還需要安裝docker-ce, docker-ee依賴,並且有指定的版本.
- 為了install這兩個以來,我們需要再新增package repositories

sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# step 2: 安裝GPG證書
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# Step 3: 寫入軟體源資訊
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
# Step 4: 更新並安裝 Docker-CE sudo apt-get -y update sudo apt-get -y install docker-ce=#指定版本
  • 最後,我們就可以通過sudo apt-get install -y nvidia-docker2來安裝nvidia-docker

  • reference: