Open jennydaman opened 6 months ago
Any chance you can get us the JSON being sent by the container create request (the first podman_client.containers.run
)? I don't have an nvidia card and as such can't use CDI to try and reproduce.
Sure.
the python code
client.containers.run('registry.access.redhat.com/ubi9:9.4-947.1714667021', ['nvidia-smi', '-L'], device_requests=[ docker.types.DeviceRequest(count=1, capabilities=[['gpu']]) ])
sends this JSON to the socket:
{
"Hostname": null,
"Domainname": null,
"ExposedPorts": null,
"User": null,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"AttachStdin": false,
"AttachStdout": true,
"AttachStderr": true,
"Env": null,
"Cmd": [
"nvidia-smi",
"-L"
],
"Image": "registry.access.redhat.com/ubi9:9.4-947.1714667021",
"Volumes": null,
"NetworkDisabled": false,
"Entrypoint": null,
"WorkingDir": null,
"HostConfig": {
"NetworkMode": "default",
"DeviceRequests": [
{
"Driver": "",
"Count": 1,
"DeviceIDs": [],
"Capabilities": [
[
"gpu"
]
],
"Options": {}
}
]
},
"NetworkingConfig": null,
"MacAddress": null,
"Labels": null,
"StopSignal": null,
"Healthcheck": null,
"StopTimeout": null,
"Runtime": null
}
@jennydaman does the following help ? https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#configuring-podman , basically using nvidia-container-toolkit
@rrbanda that is unrelated to this issue.
Podman implements the Docker API in an attempt to be compatible with Docker. This issue is about the DeviceRequests
field of Docker's API, which is different from CDI (container device interface).
Hi, thanks @jennydaman for this thread, i got the same behaviour when trying to manage podman through the Docker API. And i do not see any piece of podman code handling the DeviceRequests field from docker API.
@mheon is there something we can do to help ?
Issue Description
"Device requests" are how GPUs are invoked from the Docker API. However, device requests are not being respected by Podman when creating a container over the Podman socket.
Steps to reproduce the issue
Here is a Python script which tests the Docker and Podman socket APIs.
Setup: install Python version 3.10+ and run
pip install docker==7.0.0
Run these tests:
Describe the results you received
.HostConfig.DeviceRequests
Describe the results you expected
podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
Additional information
No response