summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBharath Vignesh J K <52282402+RazCrimson@users.noreply.github.com>2023-05-13 00:40:18 +0530
committerBharath Vignesh J K <52282402+RazCrimson@users.noreply.github.com>2023-05-13 00:40:18 +0530
commitf439b1a5636051c254da49295989702f6e4f6b3f (patch)
treead2f022cb2e75629ef43f4841a1cc34e84dbacd8
parent4bf16e956665f58392972e77449099d376a89745 (diff)
doc: docker - GPU passthrough for docker engineimprove-docker-images
-rw-r--r--docs/docker.rst48
1 files changed, 48 insertions, 0 deletions
diff --git a/docs/docker.rst b/docs/docker.rst
index 7cd57875..da7ee389 100644
--- a/docs/docker.rst
+++ b/docs/docker.rst
@@ -166,5 +166,53 @@ You can add a ``[passwords]`` block to the Glances configuration file as mention
localhost=mylocalhostpassword
default=mydefaultpassword
+Using GPU Plugin with Docker (Only Nvidia GPUs)
+------------------------------------------------------------------
+
+Complete the steps mentioned in the `docker docs <https://docs.docker.com/config/containers/resource_constraints/#gpu>`_
+to make the GPU accessible by the docker engine.
+
+With `docker run`
+^^^^^^^^^^^^^^^^^
+Include the `--gpus` flag with the `docker run` command.
+
+**Note:** Make sure the `--gpus` is present before the image name in the command, otherwise it won't work.
+
+.. code-block:: ini
+
+ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --gpus --pid host --network host -it docker.io/nicolargo/glances:latest-full
+
+..
+
+
+With `docker-compose`
+^^^^^^^^^^^^^^^^^^^^^
+Include the `deploy` section in compose file as specified below in the example service definition.
+
+.. code-block:: ini
+
+ version: '3'
+
+ services:
+ monitoring:
+ image: nicolargo/glances:latest-full
+ pid: host
+ network_mode: host
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock
+ environment:
+ - "GLANCES_OPT=-w"
+ # For nvidia GPUs
+ deploy:
+ resources:
+ reservations:
+ devices:
+ - driver: nvidia
+ count: 1
+ capabilities: [gpu]
+
+..
+
+Reference: https://docs.docker.com/compose/gpu-support/
.. _DockerHub: https://hub.docker.com/r/nicolargo/glances/tags