Unable to clone Private Git Repo in VS Code Remote Container - visual-studio-code

I have a VM running RedHat 8.6, which is running multiple LXC containers, each with Ubuntu 22.04 installed.
The RedHat VM is used as a SSH proxy to get to the LXC Containers. There are approx 10 developers in my team, each developer has their own LXC Container.
An example VS Code SSH Configuration is as follows
IdentityFile c:\users\simon.carr2\.ssh\id_ed25519
Host jump-box
HostName 10.15.236.74
IdentityFile c:\users\simon.carr2\.ssh\id_ed25519
User bob
Host container
HostName 10.36.165.29
User bob
IdentityFile c:\users\simon.carr2\.ssh\id_ed25519
ProxyCommand ssh -q -W %h:%p jump-box
I can connect to the Host called container (which is proxied through jump-box)
Once connected, in VSCode, I try to Clone Repository in Container Volume
When prompted I put the https link to my on-prem private repo (Running in GitLab)
But I am given the following error in the terminal
[85754 ms] Dev Containers 0.266.1 in VS Code 1.74.0 (5235c6bb189b60b01b1f49062f4ffa42384f8c91).
[85754 ms] Start: Run: ssh container /bin/sh
[85784 ms] Start: Run in host: id -un
[87248 ms] bob
[87249 ms]
[87251 ms] Start: Run in host: cat /etc/passwd
[87310 ms] Start: Run in host: echo ~
[87421 ms] /home/bob
[87422 ms]
[87424 ms] Start: Run in host: test -x '/home/bob/.vscode-remote-containers/bin/5235c6bb189b60b01b1f49062f4ffa42384f8c91/node'
[87546 ms]
[87547 ms]
[87547 ms] Exit code 1
[87548 ms] Start: Run in host: test -x '/home/bob/.vscode-server/bin/5235c6bb189b60b01b1f49062f4ffa42384f8c91/node'
[87654 ms]
[87655 ms]
[87656 ms] Start: Run in host: test -f '/home/bob/.vscode-server/bin/5235c6bb189b60b01b1f49062f4ffa42384f8c91/node_modules/node-pty/package.json'
[87761 ms]
[87761 ms]
[87761 ms] Start: Run in host: test -f '/home/bob/.vscode-remote-containers/dist/vscode-remote-containers-server-0.266.1.js'
[87865 ms]
[87866 ms]
[87898 ms] userEnvProbe: loginInteractiveShell (default)
[87899 ms] userEnvProbe shell: /bin/bash
[88078 ms] userEnvProbe PATHs:
Probe: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin'
Container: None
[88188 ms] Start: Run in Host: docker version --format {{.Server.APIVersion}}
[88422 ms] 1.41
[101518 ms] Start: Run in Host: git ls-remote https://gitlab.mydomain.net/gitlab-instance-eb474769/syclops-gui.git
[101724 ms]
[101725 ms] fatal: could not read Username for 'https://gitlab.mydomain.net': No such device or address
[101725 ms] Exit code 128
How do I get VSCode to prompt me for Git Credentials?

Related

How to run web server docker container in Azure devops pipeline and HTTP access it?

Please help understand the cause and solution for the issue in Azure Devops pipeline.
Trying to run a docker container which runs a web server inside inside a Azure devops pipeline as a step.
docker pull ${CONTAINER_IMAGE}
CONTAINER_ID=$(docker run -d --rm \
--cidfile cid.log \
-p 108080:8080 \
${CONTAINER_IMAGE}
)
echo "container id is ${CONTAINER_ID}"
docker ps
echo "--------------------------------------------------------------------------------"
echo "docker container ip"
IPS=$(docker container inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}' ${CONTAINER_ID})
HOST=$(echo ${IPS[0]} | xargs)
echo $HOST
echo "--------------------------------------------------------------------------------"
echo "Testing web /health response from the container..."
curl -v http://${HOST}:8080/health
When run on a laptop, it works.
pulling the container image ****
...
Digest: sha256:9edc6a55118f0909cf7120a53837ae62b8e65154bc30b89630f4f82bc0c4add7
...
**Starting the container ****...
container id is 088a28329d236582f0757862cb5bba2172ddb40c3315394db11ab39265f155b3
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
088a28329d23 **** "/bin/sh -c 'gunicor…" 6 seconds ago Up 5 seconds 0.0.0.0:18080->8080/tcp quirky_murdock
ccfc76e321aa gcr.io/inverting-proxy/agent "/bin/sh -c '/opt/bi…" 5 minutes ago Up 5 minutes proxy-agent
--------------------------------------------------------------------------------
docker container ip
172.17.0.2
--------------------------------------------------------------------------------
Testing web /health response from the container...
* Expire in 0 ms for 6 (transfer 0x55c1870780f0)
* Trying 172.17.0.2...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x55c1870780f0)
* Connected to 172.17.0.2 (172.17.0.2) port 8080 (#0)
> GET /health HTTP/1.1
> Host: 172.17.0.2:8080
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: gunicorn
< Date: Mon, 08 Aug 2022 06:44:12 GMT
< Connection: close
< Content-Type: application/json
< Content-Length: 0
<
* Closing connection 0**
However, it does not work in Azure DevOps CI pipeline.
++ docker run -d --rm --cidfile cid.log -p 18080:8080 *****
+ CONTAINER_ID=9c0f7c528b979651079d9f066c80cb9a26ec1af18415a0df5d269d252dfad0cb
+ echo 'container id is 9c0f7c528b979651079d9f066c80cb9a26ec1af18415a0df5d269d252dfad0cb'
container id is 9c0f7c528b979651079d9f066c80cb9a26ec1af18415a0df5d269d252dfad0cb
+ echo --------------------------------------------------------------------------------
+ echo 'listing docker processes...'
+ docker ps
--------------------------------------------------------------------------------
listing docker processes...
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
+ echo --------------------------------------------------------------------------------
--------------------------------------------------------------------------------
docker container ip
+ echo 'docker container ip'
+ docker container inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}' 9c0f7c528b979651079d9f066c80cb9a26ec1af18415a0df5d269d252dfad0cb
Error: No such container: 9c0f7c528b979651079d9f066c80cb9a26ec1af18415a0df5d269d252dfad0cb
Related issues
There is an issue reported.
Cannot conect to Docker container running in VSTS
The problem is that the VSTS build agent runs in a Docker container. When the Docker container for Apache is started, it runs on the same level as the VSTS build agent Docker container, not nested inside the VSTS build agent Docker container.
There are two possible solutions:
Replacing localhost with the ip address of the docker host, keeping the port number 8083
Replacing localhost with the ip address of the docker container, changing the host port number 8083 to the container port number 80.
Followed the solution as in the code above but did not work.
Please change docker ps with docker ps -a and check the logs of the died container for the reason of failure.
you can see the logs using docker logs <container-id>

vscode does not install requested extensions on image build

We have followed this guide to set up a minimal example which shows that currently in our setup extensions are not automatically installed when a development container is built.
The .devcontainer.json specifies that golang.go and ms-python.python should be installed on container build.
{
"name": "Container 1",
"dockerComposeFile": ["../docker-compose.yml"],
"service": "container-1",
"shutdownAction": "none",
"extensions": [
"golang.go",
"ms-python.python"
],
// Open the sub-folder with the source code
"workspaceFolder": "/workspace/container1-src",
}
While the extensions seem to get cached, they are not finally installed (usable). Here is an extract of the log
[23638 ms] 861598b8-962e-4242-883b-0c2e172dc4e0
[23638 ms]
[23639 ms] Start: Starting VS Code Server
[23640 ms] Start: Preparing Extensions
[23641 ms] Start: Run in container: test ! -f '/root/.vscode-server-insiders/data/Machine/.installExtensionsMarker' && set -o noclobber && mkdir -p '/root/.vscode-server-insiders/data/Machine' && { > '/root/.vscode-server-insiders/data/Machine/.installExtensionsMarker' ; } 2> /dev/null
[23652 ms]
[23653 ms]
[23660 ms] Extensions cache, install extensions: ms-python.python, golang.go, vscode.python, ms-python.vscode-pylance, ms-toolsai.jupyter, ms-python.pylint
[23661 ms] Start: Run in container: test -d /root/.vscode-server-insiders/extensionsCache && ls /root/.vscode-server-insiders/extensionsCache || true
[23666 ms]
[23666 ms]
[23670 ms] Extensions cache, copy to remote: ms-python.python-2022.4.1, ms-python.vscode-pylance-2022.4.0, ms-toolsai.jupyter-2022.3.1000901801, ms-toolsai.jupyter-keymap-1.0.0, ms-toolsai.jupyter-renderers-1.0.6
[23798 ms] Start: Run in container: # Copy extensions to remote
[24013 ms] /root
[24013 ms]
[24013 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-525ff14d87410cce22568eada8e775519d4c39e6.js' >/tmp/vscode-remote-containers-525ff14d87410cce22568eada8e775519d4c39e6.js
[24128 ms]
[24129 ms]
[24130 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-server-525ff14d87410cce22568eada8e775519d4c39e6.js' >/tmp/vscode-remote-containers-server-525ff14d87410cce22568eada8e775519d4c39e6.js_1658149613876
[24152 ms]
[24153 ms]
[24435 ms] userEnvProbe PATHs:
Probe: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
Container: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
[24474 ms]
[24475 ms]
[24476 ms] Start: Run in Host: docker exec -i -u root -e SHELL=/bin/bash -e VSCODE_AGENT_FOLDER=/root/.vscode-server-insiders -w /root/.vscode-server-insiders/bin/1cd90cceddf3c413673963ab6f154d2ff294b17c-insider 0e72ac2aff313c24e70caa3b5b9d74428f7be41d6d00acc414dc4339e84ff807 /root/.vscode-server-insiders/bin/1cd90cceddf3c413673963ab6f154d2ff294b17c-insider/bin/code-server-insiders --log debug --force-disable-user-env --server-data-dir /root/.vscode-server-insiders --use-host-proxy --telemetry-level all --accept-server-license-terms --host 127.0.0.1 --port 0 --connection-token-file /root/.vscode-server-insiders/data/Machine/.connection-token-1cd90cceddf3c413673963ab6f154d2ff294b17c-insider --extensions-download-dir /root/.vscode-server-insiders/extensionsCache --install-extension ms-python.python --install-extension golang.go --install-extension vscode.python --install-extension ms-python.vscode-pylance --install-extension ms-toolsai.jupyter --install-extension ms-python.pylint --start-server --disable-websocket-compression
...
...
25393 ms] Installing extensions...
[25400 ms] [13:06:55] Extension host agent started.
[25517 ms] Port forwarding 63455 > 34827 > 34827 stderr: Connection established
[25601 ms] Port forwarding connection from 63459 > 34827 > 34827 in the container.
[25602 ms] Start: Run in Host: docker exec -i -u root -e VSCODE_REMOTE_CONTAINERS_SESSION=966c34aa-e1b8-4837-bd34-7dcc777a8ac81658149588164 0e72ac2aff313c24e70caa3b5b9d74428f7be41d6d00acc414dc4339e84ff807 /root/.vscode-server-insiders/bin/1cd90cceddf3c413673963ab6f154d2ff294b17c-insider/node -e
[25705 ms] [13:06:55] ComputeTargetPlatform: linux-x64
[25960 ms] [13:06:55] [127.0.0.1][831a8c84][ManagementConnection] New connection established.
[26132 ms] Port forwarding 63459 > 34827 > 34827 stderr: Connection established
[26388 ms] [13:06:56] [127.0.0.1][5655a2f8][ExtensionHostConnection] New connection established.
[26425 ms] [13:06:56] [127.0.0.1][5655a2f8][ExtensionHostConnection] <250> Launched Extension Host Process.
[32331 ms] [13:07:02] Getting Manifest... ms-vscode.vscode-js-profile-table
[33009 ms] [13:07:02] Installing extension: ms-vscode.vscode-js-profile-table
[13:07:02] Installing the extension without checking dependencies and pack ms-vscode.vscode-js-profile-table
[33131 ms] [13:07:02] Extracted extension to /root/.vscode-server-insiders/extensions/.1eafe36a-5761-4868-8244-3416d12fa1b5: ms-vscode.vscode-js-profile-table
[33138 ms] [13:07:02] Renamed to /root/.vscode-server-insiders/extensions/ms-vscode.vscode-js-profile-table-1.0.3
[33142 ms] [13:07:02] Extracting completed. ms-vscode.vscode-js-profile-table
[33143 ms] [13:07:02] Extension installed successfully: ms-vscode.vscode-js-profile-table
[34480 ms] Extensions cache, remote removals: None
[94501 ms] Extensions cache, remote removals: None
[154508 ms] Extensions cache, remote removals: None
[214520 ms] Extensions cache, remote removals: None
[274526 ms] Extensions cache, remote removals: None
[334542 ms] Extensions cache, remote removals: None
Only one package is installed on image build.
Our setup:
Corporate laptop behind a firewall (zscalar) with docker for windows. Installing packages via GUI works without a problem both locally and inside the container.
We have tried this on stable and insiders. Also we have tried from plain windows and wsl.
Any ideas?
This github issue outlines the solution. While I was not getting self signed certificate in certificate chain errors in the console, adding the zscalar.crt in NODE_EXTRA_CA_CERTS resolved the issue. Extensions are now installing as expected.
I still face a similar issue with another proxy setup and cannot get it to work. Overall the extension installation seems to be very sensitive to certificates and it is still not clear to me if there is a better logging somewhere.

Fail to start Minikube on Debian

I installed Minikube on my Debian 10, but when I try to start it, I
get these errors:
$ minikube start
* minikube v1.25.2 on Debian 10.1
* Unable to pick a default driver. Here is what was considered, in preference order:
- docker: Not healthy: "docker version --format {{.Server.Os}}-{{.Server.Version}}" exit status 1: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/version: dial unix /var/run/docker.sock: connect: permission denied
- docker: Suggestion: Add your user to the 'docker' group: 'sudo usermod -aG docker $USER && newgrp docker' <https://docs.docker.com/engine/install/linux-postinstall/>
- kvm2: Not healthy: /usr/bin/virsh domcapabilities --virttype kvm failed:
error: failed to get emulator capabilities
error: invalid argument: KVM is not supported by '/usr/bin/qemu-system-x86_64' on this host
exit status 1
- kvm2: Suggestion: Follow your Linux distribution instructions for configuring KVM <https://minikube.sigs.k8s.io/docs/reference/drivers/kvm2/>
* Alternatively you could install one of these drivers:
- podman: Not installed: exec: "podman": executable file not found in $PATH
- vmware: Not installed: exec: "docker-machine-driver-vmware": executable file not found in $PATH
- virtualbox: Not installed: unable to find VBoxManage in $PATH
I added my user to the docker group using:
sudo usermod -aG docker $USER
and I insalled kvm without any apparent problems as far as I understand:
kvm --version
QEMU emulator version 3.1.0 (Debian 1:3.1+dfsg-8~deb10u1)
Copyright (c) 2003-2018 Fabrice Bellard and the QEMU Project developers
$ lsmod | grep kvm
kvm 729088 0
irqbypass 16384 1 kvm
$ sudo virsh list --all
Id Name State
-----------------------------
1 debian10-MK running
What could be the problem and solution then?
Thanks,
Tamar

Having an erro when executing flutter run

Im stuck at this problem for a week, can anyone explain to me why i cant run a flutter app either vscode or android studio. I already install all the requirements such as: sdk,ndk,emulator but i still got this problem
-
[ +23 ms] executing:
[C:\Users\hp\Desktop\Flutter\hello_world\android/]
C:\Users\hp\Desktop\Flutter\hello_world\android\gradlew.bat
-Pverbose=true -Ptarget-platform=android-arm,android-arm64,android-x64 -Ptarget=lib\main.dart -Ptrack-widget-creation=true -Ptree-shake-icons=true bundleRelease [+12053 ms] Observed package id 'system-images;android-28;google_ndk_playstore;x86' in inconsistent
location
'C:\Users\hp\AppData\Local\Android\sdk\system-images\android-28\google_apis_playstore\x86'
(Expected
'C:\Users\hp\AppData\Local\Android\sdk\system-images\android-28\google_ndk_playstore\x86')
[+1115 ms] IOException:
https://dl.google.com/android/repository/addons_list-3.xml [ +6 ms]
java.net.ConnectException: Connection refused: connect [+1226 ms]
IOException:
https://dl.google.com/android/repository/addons_list-2.xml [ +5 ms]
java.net.ConnectException: Connection refused: connect [+1166 ms]

"Connection timed out" error while connecting vscode to gcloud cloud shell

I have set up the cloud shell for vscode as given in this document; however it stopped connecting to the remote shell and it was only connected once initially. No VS Code version change happened. Current VSCode version is 1.46.1
Following are the logs thrown -
[13:31:22.078] Log Level: 2
[13:31:22.086] remote-ssh#0.51.0
[13:31:22.086] win32 x64
[13:31:22.093] SSH Resolver called for "ssh-remote+cloud-shell", attempt 1
[13:31:22.094] SSH Resolver called for host: cloud-shell
[13:31:22.094] Setting up SSH remote "cloud-shell"
[13:31:23.942] Using commit id "cd9ea6488829f560dc949a8b2fb789f3cdc05f5d" and quality "stable" for server
[13:31:23.945] Install and start server if needed
[13:31:23.951] Checking ssh with "ssh -V"
[13:31:23.957] Got error from ssh: spawn ssh ENOENT
[13:31:23.958] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[13:31:23.962] Got error from ssh: spawn C:\Windows\System32\OpenSSH\ssh.exe ENOENT
[13:31:23.962] Checking ssh with "C:\Program Files\Git\usr\bin\ssh.exe -V"
[13:31:28.385] > OpenSSH_8.3p1, OpenSSL 1.1.1g 21 Apr 2020
[13:31:28.390] Running script with connection command: "C:\Program Files\Git\usr\bin\ssh.exe" -T -D 50396 cloud-shell bash
[13:31:28.412] Terminal shell path: C:\Windows\System32\cmd.exe
[13:31:33.205] >
[13:31:33.206] Got some output, clearing connection timeout
[13:31:54.348] > ssh: connect to host 34.87.29.174 port 6000: Connection timed out
>
[13:31:54.764] "install" terminal command done
[13:31:54.765] Install terminal quit with output: ssh: connect to host 34.87.29.174 port 6000: Connection timed out
[13:31:54.766] Received install output: ssh: connect to host 34.87.29.174 port 6000: Connection timed out
[13:31:54.768] Resolver error: The connection timed out
[13:31:54.781] ------