【问题标题】:Visual Studio Online ContainersVisual Studio 在线容器
【发布时间】:2020-01-17 15:42:13
【问题描述】:

我正在尝试使用 Visual Studio Code 创建一个远程环境。我想为我的容器创建一个自定义 dockerfile。我一直在关注这里的指南:https://docs.microsoft.com/en-gb/visualstudio/online/reference/configuring

我正在使用 dockerFile 参考(但我也尝试过图像参考)。每次我得到相同的默认容器。

这是我的 .devcontainer.json 文件:

{
    "name": "Python 3",
    "context": "..",
    "dockerFile": "Dockerfile",

    // Use 'settings' to set *default* container specific settings.json values on container create. 
    // You can edit these settings after create using File > Preferences > Settings > Remote.
    "settings": { 
        "terminal.integrated.shell.linux": "/bin/bash",
        "python.pythonPath": "/usr/local/bin/python",
        "python.linting.enabled": true,
        "python.linting.pylintEnabled": true,
        "python.linting.pylintPath": "/usr/local/bin/pylint"
    },

    // Use 'appPort' to create a container with published ports. If the port isn't working, be sure
    // your server accepts connections from all interfaces (0.0.0.0 or '*'), not just localhost.
    // "appPort": [ 9000 ],

    // Install flask and any other dependencies
    "postCreateCommand": "sudo pip install -r requirements.txt",

    // Comment out next line to run as root
    "remoteUser": "vscode",

    // Add the IDs of extensions you want installed when the container is created in the array below.
    "extensions": [
        "ms-python.python",
        "quicktype.quicktype"
    ]
}

配置的其余部分似乎工作 - 扩展工作,安装 requirements.txt。但是 dockerfile 似乎被忽略或错误 - 但我不知道在哪里可以看到任何错误日志。

我也试过指向这个仓库:https://github.com/microsoft/vscode-remote-try-python,但同样的事情也会发生。该 dockerfile 指向 python:3 应该提供版本 3.8.1 - 但环境中的版本是 3.8.0,这是默认图像。

【问题讨论】:

    标签: visual-studio-code vscode-remote


    【解决方案1】:

    已解决 - 此功能尚未发布。这一次,文档似乎领先于代码。 https://github.com/MicrosoftDocs/vsonline/issues/194

    【讨论】:

      猜你喜欢
      • 2014-05-13
      • 1970-01-01
      • 2010-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-06
      • 2019-07-20
      相关资源
      最近更新 更多