devcontainers / devcontainers/spec

Optional GPU host requirement does not work with docker compose.

Open
#469 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
5.7k
Forks
496
PR merge metrics
No merged PRs in 30d

Description

When setting `"host_requirements": {"gpu": "optional"}`, the override adds the capability without the `driver` and `count` sections.

```bash
[2024-06-12T18:58:55.598Z] Stop (1970 ms): Run: docker build -f /tmp/devcontainercli-rmelancon/updateUID.Dockerfile-0.62.0 -t vsc-booster-ai-8960dda54929ced7aedbc1d531258379f1613874a876c5691c3e0f3082d263f1-uid --platform linux/amd64 --build-arg BASE_IMAGE=booster-ai-devcontainer:latest --build-arg REMOTE_USER=nonRootUser --build-arg NEW_UID=1000 --build-arg NEW_GID=1000 --build-arg IMAGE_USER=root /tmp/devcontainercli-rmelancon/empty-folder
[2024-06-12T18:58:55.599Z] Start: Run: docker info -f {{.Runtimes.nvidia}}
[2024-06-12T18:58:55.691Z] Stop (92 ms): Run: docker info -f {{.Runtimes.nvidia}}
[2024-06-12T18:58:55.692Z] Docker Compose override file for creating container:
services:
'devcontainer':
image: vsc-booster-ai-8960dda54929ced7aedbc1d531258379f1613874a876c5691c3e0f3082d263f1-uid
entrypoint: ["/bin/sh", "-c", "echo Container started\n
trap \"exit 0\" 15\n
/usr/local/share/docker-init.sh\n
exec \"$$@\"\n
while sleep 1 & wait $$!; do :; done", "-"]
environment:
- IS_INSIDE_DEVCONTAINER=true
labels:
- 'devcontainer.local_folder=\\wsl.localhost\Ubuntu-22.04\home\rmelancon\repositories\Booster-AI'
- 'devcontainer.config_file=/home/rmelancon/repositories/Booster-AI/.devcontainer/devcontainer.json'
volumes:
- /var/run/docker.sock:/var/run/docker-host.sock
- profile:/root
- /root/.vscode-server
- vscode:/vscode
deploy:
resources:
reservations:
devices:
- capabilities: [gpu]
volumes:

profile:

vscode:
external: true
```

This results in the gpu not being available in the container.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.