I am having trouble getting extensions installed in the dev container using "Remote - Containers".
I want to develop some C application in a container from an existing docker file.
Therefor I setup a .devcontainer.json
{
"name": "Jenkins_virtual_env",
"dockerFile":"../container/Dockerfile",
// Use this environment variable if you need to bind mount your local source code into a new container.
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
},
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack"
],
// 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": "docker --version",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
//"remoteUser": "vscode"
}
Now after "ReOpen in Container" the container is started and i can execute commands in this container. But when the startup comes to the installation of extensions an error es shown.
Updating C/C++ dependencies...
Downloading package 'C/C++ language components (Linux / x86_64)' Failed. Retrying... Failed. Retrying... Failed. Retrying...Waiting 8 seconds... Failed. Retrying...Waiting 16 seconds... Failed to download https://go.microsoft.com/fwlink/?linkid=2155055
Failed at stage: downloadPackages
Error: connect ECONNREFUSED 127.0.0.1:9000
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
If you work in an offline environment or repeatedly see this error, try downloading a version of the extension with all the dependencies pre-included from https://github.com/microsoft/vscode-cpptools/releases, then use the "Install from VSIX" command in VS Code to install it.
I'm not sure who want's to connect to localhost:9000 but I guess it is an application inside the container. What I see is, that there seems to be a port forward is active in the container.
Some facts about the setup:
- VisualCode version v1.53.2
- ms-vscode-remote.remote-containers v0.158.0
- ms-vscode.cpptools v1.2.1
- System: Windows 10 Enterprise 1909
- Using Docker4Windows v20.10.2 using WSL2 based images
What have I already checked: To avoid exclude errors in my dockerfile, I went back to the microsoft default c++ image (https://github.com/microsoft/vscode-remote-try-cpp). What I also checked were the used ports on my host system. What I found out, port 9000 is already in use by zscaler. But Code.exe is listening on port 9001 (what would fit to the forwared docker port).
I also played around with the "appPort" option in the .devcontainer.json, the only effect was, that I see an additional tunnle between the container and the host. The error message keeps the same.
Does anybody have an idea to this or maybe some hints how to investigate deeper? I've no clue which component causes this problem ('C/C++ extension' or 'remote container' or 'VCS' itself ... or some hidden component).