vfr*_*k66 6 docker visual-studio-code vscode-remote
我正在使用 VSCode devcontainers,如何在 devcontainers.json 中拥有一个兼容 Windows 和 MAC 的安装部分?source=...
我在访问该部分下的部分时遇到问题"mounts"
。
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.106.0/containers/python-3
{
"name": "Python 3",
"context": "..",
"dockerFile": "Dockerfile",
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "venv/bin/pylint",
},
// Change <username> to user path (Ex. /Users/vfrank/ on a MAC)
"mounts": [
"source=<full home path>/.aws/credentials,target=/home/vscode/.aws/credentials,type=bind,consistency=cached"
],
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "echo 'done'",
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
Run Code Online (Sandbox Code Playgroud)
适用于 MAC,但不适用于 Windows
"mounts": [
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.aws/credentials,target=/home/vscode/.aws/credentials,type=bind,consistency=cached"
]
Run Code Online (Sandbox Code Playgroud)
适用于 Windows,但不适用于 MAC
"mounts": [
"source=~/.aws/credentials,target=/home/vscode/.aws/credentials,type=bind,consistency=cached"
]
Run Code Online (Sandbox Code Playgroud)
我在 Windows 上为 C 驱动器和 MAC 上为 /Users 设置了 docker 文件共享设置,但在使用 devcontainers 时遇到的错误是该文件夹或文件不存在。我可以让它在两台计算机上工作,因此它与文件权限或来自 docker 的访问无关。
我正在寻找一个source=...
可以在 Windows (10+) 和 MAC 上运行的命令。
如果你这样做:
"source=${localEnv:HOME}${localEnv:USERPROFILE}\\.aws\\credentials,target=/root/.aws/credentials,type=bind,consistency=cached"
Run Code Online (Sandbox Code Playgroud)
那么每个平台上只有一个展开是非空的,你就会得到你想要的结果。
归档时间: |
|
查看次数: |
3799 次 |
最近记录: |