Docker组成GPU支持:服务。
Docker Tooling的版本:
Docker Compose version v2.6.0
Docker Engine Version 20.10.17 (client)
Docker Engine Version 20.10.17 (server)
我有一个撰写文件,该文件启动了networks
和secrets
,所以我正在使用Docker撰写文件版本3.9。
我的服务之一是GPU资源,所以我基于当前文档:
version: "3.9"
services:
my-app:
image: my-app:latest
deploy:
resources:
reservations:
devices:
- capabilities: [gpu]
count: all
. . .
我的IDE抱怨“预期标量值”,表明它无法识别功能的密钥或值:
docker stack deploy --compose-file docker-compose.yml my-stack
Docker引发了一个错误:
services.prosit-app.deploy.resources.reservations Additional property devices is not allowed
基于我使用的Docker工具的版本和我正在使用的模式,这些都应该使用(我认为)。缺少什么?
我已经尝试了各种文件版本,并且可以让IDE警告走开,但是Docker无法支持该文件版本。我尝试过有没有引号[“ GPU”]
,不同的选项等,但无济于事。
Versions of Docker tooling:
Docker Compose version v2.6.0
Docker Engine Version 20.10.17 (client)
Docker Engine Version 20.10.17 (server)
I've got a compose file that starts a swarm with networks
and secrets
, so I'm using Docker Compose File Version 3.9.
One of my services is a GPU resource, so I added this based on current docs:
version: "3.9"
services:
my-app:
image: my-app:latest
deploy:
resources:
reservations:
devices:
- capabilities: [gpu]
count: all
. . .
My IDE is complaining with "expected scalar value" indicating that it doesn't recognize the key or value of capabilities
and count
and when I run the command:
docker stack deploy --compose-file docker-compose.yml my-stack
Docker throws an error:
services.prosit-app.deploy.resources.reservations Additional property devices is not allowed
Based on the versions of my Docker tools and the schema I'm using, this should all work (I think). What am missing?
I've tried various file versions and I can get the IDE warning to go away but then Docker can't support the file version. I've tried with and without quotes ["gpu"]
, different options, etc, to no avail.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个问题已经被问到了(我的不好),我和其他人都错过了答案:
docker在尝试启用gpu
参考时,docker构成了关于属性设备的错误:
https://docs.docker.com/compose/compose/compose-file/compose-file-file-v3/#devices
This question was asked already (my bad) and the answer was missed by me and others:
Docker Compose returns error about property devices when trying to enable GPU
Reference:
https://docs.docker.com/compose/compose-file/compose-file-v3/#devices