From 5eedb0817cd58bb4bcba970659a4a63543b9c092 Mon Sep 17 00:00:00 2001 From: Adrian Plata <51415348+adrian-plata@users.noreply.github.com> Date: Fri, 19 Jul 2019 08:22:12 -0700 Subject: [PATCH] Updating docker run yaml file (#1263) Signed-off-by: Adrian Plata --- _data/engine-cli/docker_run.yaml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/_data/engine-cli/docker_run.yaml b/_data/engine-cli/docker_run.yaml index b7b3214086..5ef06961f2 100644 --- a/_data/engine-cli/docker_run.yaml +++ b/_data/engine-cli/docker_run.yaml @@ -1343,6 +1343,33 @@ examples: |- > Windows containers. This option fails if the container isolation is `hyperv` > or when running Linux Containers on Windows (LCOW). + ### Access an NVIDIA GPU + + The `--gpus­` flag allows you to access NVIDIA GPU resources. First you need to + install [nvidia-container-runtime](https://nvidia.github.io/nvidia-container-runtime/). + Visit [Specify a container's resources](https://docs.docker.com/config/containers/resource_constraints/) + for more information. + + To use `--gpus`, specify which GPUs (or all) to use. If no value is provied, all + available GPUs are used. The example below exposes all available GPUs. + + ```bash + $ docker run -it --rm --gpus all ubuntu nvidia-smi + ``` + + Use the `device` option to specify GPUs. The example below exposes a specific + GPU. + + ```bash + $ docker run -it --rm --gpus device=GPU-3a23c669-1f69-c64e-cf85-44e9b07e7a2a ubuntu nvidia-smi + ``` + + The example below exposes the first and third GPUs. + + ```bash + $ docker run -it --rm --gpus device=0,2 nvidia-smi + ``` + ### Restart policies (--restart) Use Docker's `--restart` to specify a container's *restart policy*. A restart @@ -1580,4 +1607,3 @@ experimental: false experimentalcli: false kubernetes: false swarm: false -