operation command nvidia-docker

# Nvidia-docker installation deployment and operating manual
Preface
difference docker and nvidia-docker's
because we need to use deep learning GPU, use docker, equipment, etc. need to be mapped, docker container reliance on the host will be much will be lost convenient, it does not make us very comfortable migration environment, nvidia-docker is a very good package these, only cuda version and host within the same container on the line (this requires very low, and this requirement is now basically can cuda with various versions of the mirror to meet, so almost no requirements) on the docker hub of others do
in fact nvidia-docker just run and perform different exec command and docker, exactly the same as the rest of the execution and docker

## 1 Uninstall nvidia-docker 1.0 GPU and other 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
```

## 2. Add package repositories

```
$curl -s -L https://nvidia.github.io/libnvidia-container/gpgkey | \
sudo apt-key add -
$ curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list
$ sudo tee /etc/apt/sources.list.d/nvidia-docker.list
$ sudo apt-get update
```

## 3. Installation nvidia-docker2

```
$ sudo apt-get install -y nvidia-docker2
$ sudo pkill -SIGHUP dockerd
```

## 4. Testing installation, the use of graphics view

```
$ docker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi
```

## 5. Start nvidia-docker Service

```
$ systemctl start nvidia-docker
$ systemctl status nvidia-docker
```

## 6. Specify the start gpu

```
$ NV_GPU=1 nvidia-docker run -v /matt/docker:/mnt $container --rm -ti matt/docker bash

`
## A container was renamed

`` `
$ The sudo NVIDIA Docker Tag-AB (A will be renamed B)

`
## into vessel 8.

`` `
$ Docker Exec -it vessel name / bin / bash

`
## 9. The storage container as a mirror

```

$ Docker commit containerId demo: v1.0 (the new name for the image demo, version v0.2)

```

10. The use of a mirror ## (the mirrored)

```
$ docker run -it demo:v1.0 bash

`` `
## 11.docker to do port mapping

```
$ docker run -it -d -p 0.0.0.0:5000 demo:v1.0 bash

`
Example: The container 80 port mapping to the host port 8000:

```
docker run -itd -p 8000:80 demo:v1.0 /bin/bash

`
## 12 copy files to the host vessel

`` `
$ Docker cp [-a] libcudart.so.9.0 clever_hawking: / usr / lib (clever_hawking a container name, -a is packaged way transfer)

`
## in the container 13. A copy of the file to the host

```
$ docker cp mycontainer:/opt/testnew/file.txt /opt/test/

`` `
## 14.docker container to view ip address

`` `
$ APT-GET-NET the install -Y Tools Tools NET-mounted
$ ifconfig then use ifconfig

`
## of the container 15. Management

`` `
Docker PS: list container running
docker ps -a: lists and container has stopped running
docker rm container id: delete the specified container
docker rm $ (docker ps -a -q ): remove all stop containers
docker stop container id: stop running the specified container
docker start container id: Specifies the starting container
sudo docker exec -it container name / bin / bash into the container in the running

`` `
## 16. Image Management

`` `
Docker ImagesRF Royalty Free: Lists all existing mirrored host
docker rmi Mirror id: delete the specified image
docker rmi -f Mirror id: force the removal of specified mirror
docker build -t image name: Version Path: Creating a file path based on Dockerfile a mirror
Note: all files are created at the time will have to upload the specified path, so it is best to Dockerfile files in a separate directory.

`
## 17. introduced mirror

`` `
Docker the Load: Use docker save command to export the image to import.
Example: docker load <line.tar

```

Guess you like

Origin www.cnblogs.com/wuli1427102168/p/12418893.html