[SWDEV-519170] Docker container config documentation (#178)

* add docker container guide

* add example

* update index, README, and _toc

[ROCm/amdsmi commit: 547ed49efb]
This commit is contained in:
Park, Peter
2025-03-14 10:58:46 -04:00
committed by GitHub
parent f722cec637
commit 3dbeab2c67
5 changed files with 57 additions and 0 deletions
+15
View File
@@ -139,6 +139,21 @@ Check out
[Getting to Know Your GPU: A Deep Dive into AMD SMI -- ROCm Blogs](https://rocm.blogs.amd.com/software-tools-optimization/amd-smi-overview/README.html)
for a rundown.
### Docker container configuration
To ensure proper functionality of AMD SMI within a Docker container, the
following configuration options must be included. These settings are
particularly important for managing memory partitions, as partitioning depends
on loading and unloading kernel drivers.
- `--cap-add=SYS_MODULE`
- `-v /lib/modules:/lib/modules`
See [Using AMD SMI in a Docker
container](https://rocm.docs.amd.com/projects/amdsmi/en/latest/how-to/setup-docker-container.html)
for more information.
## Building AMD SMI
This section describes the prerequisites and steps to build AMD SMI from source.
Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

@@ -0,0 +1,39 @@
---
myst:
html_meta:
"description lang=en": "Docker container configuration and setup procedures for AMD SMI."
"keywords": "api, smi, lib, system, management, interface, ROCm, docker, systemd, modprobe"
---
# Using AMD SMI in a Docker container
To ensure proper functionality of AMD SMI within a Docker container, the
following configuration options must be included. These settings are
particularly important for managing memory partitions, as partitioning depends
on loading and unloading drivers (with `systemd` dependencies):
* `--cap-add=SYS_MODULE`
This option adds the `SYS_MODULE` capability to the container, allowing it to
load and interact with kernel modules.
```{note}
Granting `SYS_MODULE` increases the container's privileges and reduces
isolation from the host. Use this option only with trusted containers and
images.
```
* `-v /lib/modules:/lib/modules`
By mounting the `/lib/modules/` directory into the container, the container
gains access to the host's kernel modules, allowing it to load and interact
with them. Without this access, operations requiring module loading like
memory partitioning would fail.
For example:
```{image} ../data/how-to/setup-docker-container/docker-run-example.jpg
:alt: Command line example of running a Docker container for AMD SMI
:align: center
:width: 100%
```
+1
View File
@@ -32,6 +32,7 @@ AMD SMI is the successor to <https://github.com/ROCm/rocm_smi_lib>.
* [Python library usage](./how-to/amdsmi-py-lib.md)
* [Go library usage](./how-to/amdsmi-go-lib.md)
* [CLI tool usage](./how-to/amdsmi-cli-tool.md)
* [Use AMD SMI in a Docker container](./how-to/setup-docker-container.md)
:::
:::{grid-item-card} Reference
+2
View File
@@ -19,6 +19,8 @@ subtrees:
title: Go library usage
- file: how-to/amdsmi-cli-tool.md
title: CLI tool usage
- file: how-to/setup-docker-container.md
title: Use AMD SMI in a Docker container
- caption: Reference
entries: