1. Go to github website to download Nvdia-docker
The command to download and install Nvdia-docker is
# If you have Nvidia-docker 1.0 installed:we need-remove it and all existing GPU containers
Docker volume Ls-q-F Driver=nvidia-docker | Xargs-r-i{}-n1 docker ps-q-a-f volume={} | Xargs-r Docker rm-f
sudo apt-get purge-y nvidia-docker
# ADD The package repositories
curl-s-L HTTPS://NV Idia.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
# T EST Nvidia-smi with the latest official CUDA image
Docker run--runtime=nvidia--rm Nvidia/cuda Nvidia-smi
However, the installation of Nvdia-docker depends on the docker-ce or Docker-ee, so the dependency conditions must be met first, and the requirements for DOCKER-CE and Docker-ee also have versions.
maya@maya-g450:~$ sudo apt-get install-y nvidia-docker2
is reading the package list ... Completing
the dependency tree that is analyzing the package is
reading state information ... Complete
Some packages that cannot be installed. If you are using the unstable release, this may be due to the
system not being able to meet the status you requested. Some of the packages you need may not have been created in this release
or have been removed from the new to (Incoming) directory.
The following information may be helpful in resolving a problem:
The following packages have unsatisfied dependencies:
Nvidia-docker2: Dependency: docker-ce (= 17.12.0~ce-0~ubuntu) but 18.01.0~ce-0 ~ubuntu is about to be installed or
docker-ee (= 17.12.0~ee-0~ubuntu) but cannot install it
E: cannot fix the error because you require certain packages to remain current, that is, they destroy the dependencies between packages.
2. Installing Docker-ce
(1) Query the version of Docker-ce
Apt-cache Madison Docker-ce
docker-ce | 17.12.0~ce-0~ubuntu | Https://download.docker.com/linux/ubuntu xenial/ Stable AMD64 Packages
(2) installation of version 17.12.0 Docker-ce
sudo apt-get install Docker-ce=17.12.0~ce-0~ubuntu is reading the package list ... Complete the dependency tree that is analyzing the package reading status information ... Complete Recommended packages: Aufs-tools The following packages will be "degraded": DOCKER-CE upgraded 0 packages, newly installed 0 packages, reduced
Level 1 packages, to uninstall 0 packages, 463 packages were not upgraded.
You need to download the 30.2 MB package.
17.3 MB of space will be vacated after decompression. Do you want to continue. [y/n] Y get: 1 https://download.docker.com/linux/ubuntu/trusty/edge docker-ce amd64 17.12.0~ce-0~ubuntu [30.2 MB] Download 30.2 MB, time 5 2 seconds (574 kb/s) dpkg: Warning: Docker-ce will be downgraded from 18.01.0~ce-0~ubuntu to 17.12.0 ~ce-0~ubuntu (Reading Database ... The system currently has a total of 302,951 files and directories installed.
is preparing to unpack .../docker-ce_17.12.0~ce-0~ubuntu_amd64.deb ...
Unpacking Docker-ce (17.12.0~ce-0~ubuntu) to (18.01.0~ce-0~ubuntu) ... Processing is being processed for Ureadahead (0.100.0-16) Trigger ...
Processing triggers for man-db (2.6.7.1-1UBUNTU1) ...
Setting Docker-ce (17.12.0~ce-0~ubuntu) ...
Installing new version of configuration file/etc/bash_completion.d/docker. Docker start/running, Process 17636
3. Formal installation of Nvdia-docker
maya@maya-g450:~$ sudo apt-get install-y nvidia-docker2 is reading the package list ... Completing the dependency tree that is analyzing the package is reading state information ... Completion will install the following additional packages: Libnvidia-container-tools Libnvidia-container1 nvidia-container-runtime The following "new" packages will be installed: Libnvidi A-container-tools libnvidia-container1 nvidia-container-runtime nvidia-docker2 upgraded 0 packages, installed 4 new packages, uninstalled 0 packages, 464
The package has not been upgraded.
You need to download the 2,044 KB package.
9,755 KB of extra space is consumed after decompression.
Get: 1 https://nvidia.github.io/libnvidia-container/ubuntu16.04/amd64/libnvidia-container1 1.0.0~alpha.3-1 [54.3 KB] Get: 2 Https://nvidia.github.io/libnvidia-container/ubuntu16.04/amd64/libnvidia-container-tools 1.0.0~alpha.3-1 [ 14.5 KB] gets: 3 Https://nvidia.github.io/nvidia-container-runtime/ubuntu16.04/amd64/nvidia-container-runtime 1.1.1+ docker17.12.0-1 [1,972 KB] gets: 4 Https://nvidia.github.io/nvidia-docker/ubuntu16.04/amd64/nvidia-docker2 2.0.2+ docker17.12.0-1 [2,782 B] Download 2,044 KB, takes 17 seconds (kb/s) Selecting an unselected package libnvidia- Container1: AMD64. (Reading Database ... The system currently has a total of 302,951 files and directories installed.
is preparing to unpack .../libnvidia-container1_1.0.0~alpha.3-1_amd64.deb ...
Unpacking libnvidia-container1:amd64 (1.0.0~alpha.3-1) ...
Selecting Libnvidia-container-tools package is not selected.
Preparing for unpacking .../libnvidia-container-tools_1.0.0~alpha.3-1_amd64.deb ...
Unpacking Libnvidia-container-tools (1.0.0~alpha.3-1) ...
Selecting Nvidia-container-runtime package is not selected.
Preparing for unpacking .../nvidia-container-runtime_1.1.1+docker17.12.0-1_amd64.deb ...
Unpacking Nvidia-container-runtime (1.1.1+docker17.12.0-1) ...
Selecting Nvidia-docker2 package is not selected.
Preparing for unpacking .../nvidia-docker2_2.0.2+docker17.12.0-1_all.deb ...
Unpacking Nvidia-docker2 (2.0.2+docker17.12.0-1) ...
Processing triggers for Libc-bin (2.19-0ubuntu6.9) ...
Setting Libnvidia-container1:amd64 (1.0.0~alpha.3-1) ...
Setting Libnvidia-container-tools (1.0.0~alpha.3-1) ...
Setting Nvidia-container-runtime (1.1.1+docker17.12.0-1) ...
Setting Nvidia-docker2 (2.0.2+docker17.12.0-1) ...
Processing triggers for Libc-bin (2.19-0ubuntu6.9) ...
Resources:
Installation documentation for 1.docker: https://docs.docker.com/install/linux/docker-ce/ubuntu/#upgrade-docker-ce
2.nvdia-docker's GitHub official website: https://github.com/NVIDIA/nvidia-docker