Open lpasselin opened 4 months ago
Having the same issue, and it's a pain for my team, as we have multiple people working with Macbooks... Really hoping for this to be fixed.
For docker compose, I have a hacky fix:
I simply use this script I created and extend my docker-compose.yml's devcontainer service with the file created:
#!/bin/bash
target_file="environments/devcontainer/gpu_optional.docker-compose.yml"
snippets_path="environments/devcontainer/build_utils/snippets"
if ! nvidia-smi >/dev/null; then
cp "${snippets_path}/without_gpu.docker-compose.yml" "${target_file}"
else
cp "${snippets_path}/with_gpu.docker-compose.yml" "${target_file}"
fi
where ${snippets_path}/without_gpu.docker-compose.yml
contains:
services:
devcontainer:
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
and ${snippets_path}/with_gpu.docker-compose.yml
contains:
services:
devcontainer:
Hope this helps!
docker info -f '{{.Runtimes.nvidia}}' --> returns nvidia-container-runtime
@lpasselin This case should work. Please append the Dev Containers log from when you rebuild the container. (F1
> Dev Containers: Show Container Log
)
@chrmarti in my case, what I found what that although the runtime is nvidia-container-runtime, the docker compose config used has a deploy
section that looks like this:
services:
devcontainer-service:
deploy:
resources:
reservations:
devices:
- capabilities: [gpu]
count: all
The driver: nvidia
part is missing...
Could you share the output from docker info --format '{{json .}}'
?
Same as this issue which is for windows: https://github.com/microsoft/vscode-remote-release/issues/9385
docker info -f '{{.Runtimes.nvidia}}' --> returns nvidia-container-runtime
Temporary fix is to add this to our docker-compose.yml but it breaks for users without gpu
When reverting to using a dockerfile instead of docker-compose,
"runArgs": [ "--gpus", "all" ]
does work