带有 /dev /kvm模块的docker映像

发布于 2025-01-23 16:06:34 字数 396 浏览 3 评论 0原文

我想在我的Docker图像中使用KVM。 KVM和QEMU-SYSTEM-X86_64安装在 /usr /bin下,但是当我运行时。 /usr/bin/qemu-system-x86_64 -enable-kvm
我得到了

Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory

我能够通过添加- device =/dev/kvm来解决错误。
我的问题是,为什么需要从我的主机附加此KVM模块?为什么需要在 /开发目录中?

I want to use kvm in my docker image. kvm and qemu-system-x86_64 are installed under /usr/bin but when I run eg. /usr/bin/qemu-system-x86_64 -enable-kvm
I'm getting

Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory

I was able to fix to error by adding --device=/dev/kvm to docker run command.
My question is why this kvm module need to be attached from my host? Why it's required to be under /dev directory?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文