如何在 devcontainer 上传递 --device?
How to pass a --device on devcontainer?
我有这个 docker 运行 命令:
sudo docker run --device=/dev/kvm -it -v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY -v $PWD/../project:/home/project \
-v /mnt/android-dev-3:/home/project/disk \
-v /home/$USER/Android:/home/project/sdk \
-it aosp_builder /bin/bash
我正在像这样在 devcontainer 中复制它:
{
"name": "AOSP development",
"dockerFile": "../docker/Dockerfile",
"extensions": [
"dracula-theme.theme-dracula",
"ms-vscode.cpptools",
"mhutchie.git-graph",
"eamodio.gitlens",
],
"mounts": ["source=/mnt/android-dev-3,target=/home/project/disk,consistency=cached",
"source=/home/${USER}/Android,target=/home/project/sdk,consistency=cached",
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,consistency=cached"],
"containerEnv": {
"DISPLAY": "unix${DISPLAY}",
},
"workspaceFolder": "/home/project"
}
但是缺少 --device=/dev/kvm
。我该如何添加?
"runArgs": ["--device=/dev/kvm"]
我有这个 docker 运行 命令:
sudo docker run --device=/dev/kvm -it -v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$DISPLAY -v $PWD/../project:/home/project \
-v /mnt/android-dev-3:/home/project/disk \
-v /home/$USER/Android:/home/project/sdk \
-it aosp_builder /bin/bash
我正在像这样在 devcontainer 中复制它:
{
"name": "AOSP development",
"dockerFile": "../docker/Dockerfile",
"extensions": [
"dracula-theme.theme-dracula",
"ms-vscode.cpptools",
"mhutchie.git-graph",
"eamodio.gitlens",
],
"mounts": ["source=/mnt/android-dev-3,target=/home/project/disk,consistency=cached",
"source=/home/${USER}/Android,target=/home/project/sdk,consistency=cached",
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,consistency=cached"],
"containerEnv": {
"DISPLAY": "unix${DISPLAY}",
},
"workspaceFolder": "/home/project"
}
但是缺少 --device=/dev/kvm
。我该如何添加?
"runArgs": ["--device=/dev/kvm"]