Proxy Settings
I found this issue:
https://github.com/microsoft/vscode-remote-release/issues/6464
If I want to Build a devcontainer I have to export http_proxy as ENV, otherwise I cannot install the feature. I am behind a corporate Proxy. Docker is configured correctly all normal build are fine.
How can I use the Proxy for installing a feature without export a ENV variable? Use the Docker Proxy...
Same problem here
VSCode Settings:
"http.proxy": "http://proxy.ourdomain.de:3128",
"http.proxyStrictSSL": false,
"http.proxyAuthorization": null,
After choosing a Template, the connection failed
[251568 ms] Start: Run: C:\Program Files\Microsoft VS Code\Code.exe c:\Users\xxx\.vscode\extensions\ms-vscode-remote.remote-containers-0.388.0\dist\spec-node\devContainersSpecCLI.js templates apply --workspace-folder C:\Users\xxx\AppData\Local\Temp\tmp-output-dir-1732627965654 --template-id ghcr.io/devcontainers/templates/ubuntu --template-args {"imageVariant":"jammy"} --features [{"id":"ghcr.io/itsmechlark/features/postgresql:1","options":{}}] --tmp-dir C:\Users\xxx\AppData\Local\Temp\tmp-dir-1732627965654 --log-level debug --omit-paths [".github/dependabot.yml"]
[251741 ms] [2024-11-26T13:32:45.822Z] @devcontainers/cli 0.71.0. Node.js v20.18.0. win32 10.0.22621 x64.
[251745 ms] [2024-11-26T13:32:45.828Z] Loading 56 extra certificates from C:\Users\xxx\AppData\Local\Temp\vsch\certificates-89a0850ff26e601ba3746ea9faaa3591f7be0787da138626eb8385efc58fd6fe.pem.
[272819 ms] Error: connect ETIMEDOUT 140.82.121.34:443
[272819 ms] at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1607:16) {
[272819 ms] errno: -4039,
[272819 ms] code: 'ETIMEDOUT',
[272820 ms] syscall: 'connect',
[272820 ms] address: '140.82.121.34',
[272820 ms] port: 443
[272820 ms] }
[272827 ms] Exit code 1
Maybe the proxy is ignored for HTTPS Connections?
+1
I can only report how we handle everything:
For VSCode, we do not have any proxy settings, we let it use the environment variables http_proxy, https_proxy and no_proxy. I suppose this also helps making it work if we use VSCode locally and connected to a remote (WSL) with different proxy settings.
To add the proxy during build-time, we simply modified the Docker config (~/.docker/config.json) to add our desired proxy to each container, eg:
{
"proxies": {
"default": {
"httpProxy": "http://proxy.ourdomain.de:3128",
"httpsProxy": "http://proxy.ourdomain.de:3128",
"noProxy": "localhost,127.0.0.1,local,ourdomain.de"
}
}
}
You could probably also just add this information to the devcontainer.json like:
"build": {
"dockerfile": "Dockerfile",
"args": {
"http_proxy": "ttp://proxy.ourdomain.de:3128",
"https_proxy": "ttp://proxy.ourdomain.de:3128",
"no_proxy": "localhost,127.0.0.1,local,ourdomain.de"
}
}
Side-Note: As our proxy needs authentication, we usually just install a local proxy (px in Windows) which takes care of the authorization and then just use http://localhost:3128 as the proxy everywhere.
For the WSL-Setup, we use cntlm and forward it to windows-host:3128 so that it in the end also goes thru the Windows px proxy with correct authentication information. For that to work then in a Docker-Container (as localhost would be the container and not WSL), we set the container proxy to http://host.docker.internal:8888 (8888 is the port where cntlm is running in WSL) and just make sure, that all containers are started with the option --add-host=host.docker.internal:host-gateway so it can resolve host.docker.internal correctly to the docker host. For dev-containers this is done in the follwing sections:
Build-Time:
"build": {
"dockerfile": "Dockerfile",
"options": ["--add-host=host.docker.internal:host-gateway"],
}
Run-Time:
"runArgs": [
"--add-host=host.docker.internal:host-gateway",
]