`Dev Container: Add Dev Containers Configuration files
...`で設定ファイルを追加すると、以前は、`.devcontainer`ディレクトリに`devcontainer.json`と`Dockerfile`が追加されていました。

追加されたファイルに下記の設定を追加して利用していました。

```

        "build": {
            "args": {
                "http_proxy": "${localEnv:http_proxy}",
                "https_proxy": "${localEnv:http_proxy}",
                "no_proxy": "${localEnv:no_proxy}"
            }
        },
        "containerEnv": {
            "http_proxy": "${localEnv:http_proxy}",
            "https_proxy": "${localEnv:http_proxy}",
            "no_proxy": "${localEnv:no_proxy}"
        }
    
```

VSCodeをOctober 2022(version
1.73)にアップデートしたところ、`.devcontainer/devcontainer.json`だけが追加されるようになりました。

追加されるファイルは、下記の通りです。

```

    {
        "name": "Python 3",
        "image": "mcr.microsoft.com/devcontainers/python:3.10-bullseye",
        "features": {
            "ghcr.io/devcontainers/features/node:1": {
                "version": "lts"
            }
        },
    
        // 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": "pip3 install --user -r requirements.txt",
    
        // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
        "remoteUser": "vscode"
    }
    
```

そのまま起動すると下記のようなエラーが出ます。

```

    Options       :
        VERSION="lts"
        NODEGYPDEPENDENCIES="true"
        NVMINSTALLPATH="/usr/local/share/nvm"
        NVMVERSION="0.39.2"
    ===========================================================================
    [2022-11-04T00:54:05.451Z] Yarn already installed.
    [2022-11-04T00:54:05.475Z] NVM already installed.
    [2022-11-04T00:57:40.344Z] Version '' (with LTS filter) not found - try `nvm ls-remote --lts` to browse available versions.
    [2022-11-04T00:57:40.346Z] ERROR: Feature "Node.js (via nvm) and yarn" (ghcr.io/devcontainers/features/node) failed to install! Look at the documentation at https://github.com/devcontainers/features/tree/main/src/node for help troubleshooting this error.
    [2022-11-04T00:57:40.543Z] The command '/bin/sh -c cd /tmp/build-features/node_1 && chmod +x ./devcontainer-features-install.sh && ./devcontainer-features-install.sh' returned a non-zero code: 3
    [2022-11-04T00:57:40.544Z] Stop (215651 ms): Run: docker build --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/python:3.10-bullseye --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-ms-identity-javascript-react-spa-1693c68eb136e712db187f2bdf7e772d-features -f /tmp/devcontainercli-ubuntu/container-features/0.23.2-1667523242160/Dockerfile.extended /tmp/devcontainercli-ubuntu/empty-folder
    [2022-11-04T00:57:40.536Z] Error: Command failed: docker build --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/python:3.10-bullseye --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-ms-identity-javascript-react-spa-1693c68eb136e712db187f2bdf7e772d-features -f /tmp/devcontainercli-ubuntu/container-features/0.23.2-1667523242160/Dockerfile.extended /tmp/devcontainercli-ubuntu/empty-folder
    [2022-11-04T00:57:40.537Z]     at loe (/home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js:1887:1339)
    [2022-11-04T00:57:40.537Z]     at eT (/home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js:1887:1275)
    [2022-11-04T00:57:40.538Z]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
    [2022-11-04T00:57:40.538Z]     at async voe (/home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js:1893:2049)
    [2022-11-04T00:57:40.538Z]     at async Xf (/home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js:1893:3212)
    [2022-11-04T00:57:40.539Z]     at async Jae (/home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js:2013:15058)
    [2022-11-04T00:57:40.540Z]     at async Wae (/home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js:2013:14812)
    [2022-11-04T00:57:40.556Z] Stop (219210 ms): Run in Host: /home/ubuntu/.vscode-remote-containers/bin/8fa188b2b301d36553cbc9ce1b0a146ccb93351f/node /home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js up --workspace-folder /home/ubuntu/ghq/github.com/ksaito1125/ms-identity-javascript-react-spa --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/ubuntu/ghq/github.com/ksaito1125/ms-identity-javascript-react-spa --log-level debug --log-format json --config /home/ubuntu/ghq/github.com/ksaito1125/ms-identity-javascript-react-spa/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true --terminal-columns 80 --terminal-rows 30
    [2022-11-04T00:57:40.557Z] Exit code 1
    [2022-11-04T00:57:40.563Z] Command failed: /home/ubuntu/.vscode-remote-containers/bin/8fa188b2b301d36553cbc9ce1b0a146ccb93351f/node /home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js up --workspace-folder /home/ubuntu/ghq/github.com/ksaito1125/ms-identity-javascript-react-spa --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/ubuntu/ghq/github.com/ksaito1125/ms-identity-javascript-react-spa --log-level debug --log-format json --config /home/ubuntu/ghq/github.com/ksaito1125/ms-identity-javascript-react-spa/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true --terminal-columns 80 --terminal-rows 30
    [2022-11-04T00:57:40.563Z] Exit code 1
    
```

確証はないのですが、featuresは、起動したコンテナに対して設定作業を行っているようで、その際にproxyが認識されていないのではないかt推測しています。

該当のバージョンのVSCodeでProxy環境下で開発コンテナを起動できている方がいたら、設定を教えていただけないでしょうか。
CC BY-SA 4.0
2022-11-04T01:30:58.037
91978
2023-03-11T07:02:15.357
5285
question
vscode
VSCodeに開発コンテナのビルド時のproxy設定方法がわからない。
[.docker/config.json](https://matsuand.github.io/docs.docker.jp.onthefly/network/proxy/#configure-
the-docker-client)にproxyを設定することで解決しました。

詳細は、[こちら](https://github.com/devcontainers/templates/issues/32)を参照
CC BY-SA 4.0
2022-11-09T02:29:57.397
92096
2022-11-09T02:29:57.397
5285
91978
answer