vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

Unable to connect to remote container with Dev Containers extension 0.338.1

Open arjunbalgovind opened this issue 1 year ago • 2 comments

  • VSCode Version: 1.86.0
  • Local OS Version: Windows 10.0.22635.3139
  • Remote OS Version: Azure Linux
  • Remote Extension/Connection Type: Containers
  • Logs:
[44 ms] Dev Containers 0.338.1 in VS Code 1.86.0 (05047486b6df5eb8d44b2ecd70ea3bdf775fd937).
[44 ms] Start: Run: ssh <redacted>feb5 /bin/sh
[86 ms] Start: Run in host: id -un
[2881 ms] arbalgov
[2881 ms] 
[2882 ms] Start: Run in host:  (command -v getent >/dev/null 2>&1 && getent passwd 'arbalgov' || grep -E '^arbalgov|^[^:]*:[^:]*:arbalgov:' /etc/passwd || true)
[2924 ms] Start: Run in host: echo ~
[2966 ms] /home/arbalgov
[2967 ms] 
[2969 ms] Start: Run in host: test -x '/home/arbalgov/.vscode-remote-containers/bin/05047486b6df5eb8d44b2ecd70ea3bdf775fd937/node'
[3012 ms] 
[3013 ms] 
[3014 ms] Start: Run in host: test -f '/home/arbalgov/.vscode-remote-containers/dist/vscode-remote-containers-server-0.338.1.js'
[3053 ms] 
[3053 ms] 
[3090 ms] userEnvProbe: loginInteractiveShell (default)
[3090 ms] userEnvProbe: not found in cache
[3091 ms] userEnvProbe shell: /bin/bash
[3149 ms] Host server: Error: spawn /bin/bash ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[3190 ms] Error reading shell environment.
[3190 ms] Error: spawn /bin/bash ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[3191 ms] Host server: (node:549568) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
(Use `node --trace-warnings ...` to show where the warning was created)
[3270 ms] Start: Resolving Remote
[3271 ms] Setting up container: <redacted>
[3271 ms] Host: ssh://<redacted>feb5
[3276 ms] Start: Run: ssh <redacted>feb5 /bin/sh
[3314 ms] Start: Run in host: id -un

Steps to Reproduce: The issue occurs on the latest version of the Dev Containers extension (0.338.1) but not on 0.327.0. We host Linux VMs with Linux containers and programmatically connect to the remote Linux container using the Dev Containers extension as part of our service.

Does this issue occur when you try this locally?: No Does this issue occur when you try this locally and all extensions are disabled?: Yes/No

arjunbalgovind avatar Feb 06 '24 00:02 arjunbalgovind

Similar problem in MacOS M2 Pro when trying Attach Visual Studio Code

vscode-dev-containers-errors

And my error notification goes as

Error running command remote-containers.attachToRunningContainerFromViewlet: Command failed: docker inspect --type container 20a3f19a42c42bc23ad1f920cc657748554d7560c57c06254b88c9b935a5d9e9. This is likely caused by the extension that contributes remote-containers.attachToRunningContainerFromViewlet.

Running the failed command as follows mannually WORKS in bash

export DOCKER_HOST="tcp://1.2.3.4:2376"
export DOCKER_CERT_PATH=/Users/hello/.docker-world"
export DOCKER_TLS_VERIFY=1

docker inspect --type container 20a3f19a42c42bc23ad1f920cc657748554d7560c57c06254b88c9b935a5d9e9

where 1.2.3.4 is my desensitized remote server IP.

Possible cause may be that vscode disrespects docker.environment in settings.json and connects to the local docker daemon as indicated by following logs shown by Dev Containers Developer: Show All Logs

Local docker daemon's version is 1.44, and remote docker daemon's version is 1.43.

[2024-02-06T03:48:19.336Z] Dev Containers 0.327.0 in VS Code 1.86.0 (05047486b6df5eb8d44b2ecd70ea3bdf775fd937).
[2024-02-06T03:48:19.336Z] Start: Run: docker version --format {{.Server.APIVersion}}
[2024-02-06T03:48:19.372Z] Stop (36 ms): Run: docker version --format {{.Server.APIVersion}}
[2024-02-06T03:48:19.373Z] 
[2024-02-06T03:48:19.373Z] Cannot connect to the Docker daemon at unix:///Users/xiangminli/.docker/run/docker.sock. Is the docker daemon running?

[2024-02-06T03:49:04.562Z] Start: Run: docker version --format {{.Server.APIVersion}}
[2024-02-06T03:49:04.617Z] Stop (55 ms): Run: docker version --format {{.Server.APIVersion}}
[2024-02-06T03:49:04.617Z] 1.44
[2024-02-06T03:49:04.618Z] Start: Run: docker inspect --type container 20a3f19a42c42bc23ad1f920cc657748554d7560c57c06254b88c9b935a5d9e9
[2024-02-06T03:49:04.658Z] Stop (40 ms): Run: docker inspect --type container 20a3f19a42c42bc23ad1f920cc657748554d7560c57c06254b88c9b935a5d9e9

Really appreciate if someone can help~

sammyne avatar Feb 06 '24 03:02 sammyne

Does this reproduce with VS Code 1.86.1? There is a chance this was a side-effect of https://github.com/microsoft/vscode/issues/204344.

chrmarti avatar Feb 13 '24 10:02 chrmarti

@arjunbalgovind shared the setup in private and I think I have a fix in 0.346.0-pre-release of the extension.

@sammyne I think yours might be a different issue, could you open a new issue if the latest pre-release doesn't fix it?

chrmarti avatar Feb 19 '24 16:02 chrmarti

@arjunbalgovind shared the setup in private and I think I have a fix in 0.346.0-pre-release of the extension.

@sammyne I think yours might be a different issue, could you open a new issue if the latest pre-release doesn't fix it?

Check the new issue at https://github.com/microsoft/vscode-remote-release/issues/9568 @chrmarti

sammyne avatar Feb 20 '24 02:02 sammyne

Thanks @sammyne!

@arjunbalgovind Confirmed the fix is working. Closing as verified, thanks!

chrmarti avatar Feb 20 '24 18:02 chrmarti