microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.6k stars 273 forks source link

Dev container: `Attach Visual Studio Code` fails with `Workspace does not exist` #8328

Open aeschli opened 1 year ago

aeschli commented 1 year ago

Version: 1.77.1 Commit: b7886d7461186a5eac768481578c1d7ca80e2d21 Date: 2023-04-04T23:20:37.202Z Electron: 19.1.11 Chromium: 102.0.5005.196 Node.js: 16.14.2 V8: 10.2.154.26-electron.0 OS: Linux x64 5.15.0-69-generic snap Sandboxed: No

From our smoke test. Run a doceker with ARM (not sure that really matters)

In the terminal, run: docker run --privileged --rm tonistiigi/binfmt --install all docker run -d arm64v8/ubuntu sleep inf In VS Code, in the Docker viewlet, find the running container and run Attach Visual Studio Code from the context menu New windows ends with an error dialog: image

[78 ms] Dev Containers 0.255.4 in VS Code 1.77.1 (b7886d7461186a5eac768481578c1d7ca80e2d21).
[77 ms] Start: Resolving Remote
[80 ms] Setting up container: /musing_babbage
[97 ms] Start: Run: docker inspect --type container /musing_babbage
[221 ms] Start: Check Docker is running
[221 ms] Start: Run: docker version --format {{.Server.APIVersion}}
[314 ms] Server API version: 1.41
[316 ms] Start: Inspecting container
[316 ms] Start: Run: docker inspect --type container d1b2a27bb32d59e87ad6b6527e9301f04611a7f8708dc5fb69121e990fe19a30
[365 ms] Start: Run in container: /bin/sh
[374 ms] Start: Run in container: uname -m
[553 ms] aarch64
[553 ms] 
[554 ms] Start: Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null
[591 ms] NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
[592 ms] 
[593 ms] Start: Run in container: cat /etc/passwd
[622 ms] Start: Run in container: test -d /root/.vscode-server
[626 ms] 
[626 ms] 
[628 ms] Start: Run in container: test ! -f '/root/.vscode-server/data/Machine/.writeMachineSettingsMarker' && set -o noclobber && mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.writeMachineSettingsMarker' ; } 2> /dev/null
[632 ms] 
[633 ms] 
[633 ms] Exit code 1
[633 ms] Start: Run in container: cat /root/.vscode-server/data/Machine/settings.json
[665 ms] 
[666 ms] cat: /root/.vscode-server/data/Machine/settings.json: No such file or directory
[666 ms] Exit code 1
[666 ms] 
Support for ARM64 is in preview.

[666 ms] Start: Run in container: test -d /root/.vscode-server/bin/b7886d7461186a5eac768481578c1d7ca80e2d21
[669 ms] 
[670 ms] 
[670 ms] Start: Launching Dev Containers helper.
[670 ms] ssh-agent: SSH_AUTH_SOCK in container (/tmp/vscode-ssh-auth-6676f2560f420853fccf567487f4bb065b823c8a.sock) forwarded to local host (/run/user/1000/keyring/ssh).
[671 ms] Start: Run: gpgconf --list-dir agent-extra-socket
[676 ms] /run/user/1000/gnupg/S.gpg-agent.extra
[676 ms] 
[676 ms] Start: Run in container: gpgconf --list-dir agent-socket
[680 ms] 
[681 ms] /bin/sh: 8: gpgconf: not found
[681 ms] Exit code 127
[682 ms] Start: Run in container: /bin/sh
[686 ms] userEnvProbe: loginInteractiveShell (default)
[687 ms] Start: Run in container: echo ~
[687 ms] userEnvProbe shell: /bin/bash
[690 ms] Start: Run in container: # Test for /root/.ssh/known_hosts and ssh
[697 ms] ssh not found
[698 ms] 
[698 ms] Exit code 1
[698 ms] Start: Run in container: command -v git >/dev/null 2>&1 && git config --system --replace-all credential.helper '!f() { /root/.vscode-server/bin/b7886d7461186a5eac768481578c1d7ca80e2d21/node /tmp/vscode-remote-containers-6676f2560f420853fccf567487f4bb065b823c8a.js $*; }; f' || true
[703 ms] 
[703 ms] 
[704 ms] Start: Run in container: for pid in `cd /proc && ls -d [0-9]*`; do { echo $pid ; readlink /proc/$pid/cwd ; readlink /proc/$pid/ns/mnt ; cat /proc/$pid/stat | tr "
[853 ms] /root
[853 ms] 
[853 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-6676f2560f420853fccf567487f4bb065b823c8a.js' >/tmp/vscode-remote-containers-6676f2560f420853fccf567487f4bb065b823c8a.js
[886 ms] 
[886 ms] 
[886 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-server-6676f2560f420853fccf567487f4bb065b823c8a.js' >/tmp/vscode-remote-containers-server-6676f2560f420853fccf567487f4bb065b823c8a.js_1680699048144
[957 ms] 
[957 ms] 
[1351 ms] Start: Run in container: cat '/root/.vscode-server/data/Machine/.connection-token-b7886d7461186a5eac768481578c1d7ca80e2d21' 2>/dev/null || (umask 377 && echo '0475cb4a-3b6f-4cf2-8ff3-bf7de1497eb6' >'/root/.vscode-server/data/Machine/.connection-token-b7886d7461186a5eac768481578c1d7ca80e2d21-712102bb-bf60-4312-b8d9-604d44f00e35' && mv -n '/root/.vscode-server/data/Machine/.connection-token-b7886d7461186a5eac768481578c1d7ca80e2d21-712102bb-bf60-4312-b8d9-604d44f00e35' '/root/.vscode-server/data/Machine/.connection-token-b7886d7461186a5eac768481578c1d7ca80e2d21' && rm -f '/root/.vscode-server/data/Machine/.connection-token-b7886d7461186a5eac768481578c1d7ca80e2d21-712102bb-bf60-4312-b8d9-604d44f00e35' && cat '/root/.vscode-server/data/Machine/.connection-token-b7886d7461186a5eac768481578c1d7ca80e2d21')
[1381 ms] b3aaffcf-49e3-42af-9697-59b04e3dfa74
[1381 ms] 
[1382 ms] Start: Starting VS Code Server
[1383 ms] Start: Preparing Extensions
[1383 ms] Start: Run in container: test ! -f '/root/.vscode-server/data/Machine/.installExtensionsMarker' && set -o noclobber && mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.installExtensionsMarker' ; } 2> /dev/null
[1386 ms] 
[1387 ms] 
[1387 ms] Exit code 1
[1388 ms] Extensions cache, install extensions: None
[1388 ms] Start: Run in container: test -d /root/.vscode-server/extensionsCache && ls /root/.vscode-server/extensionsCache || true
[1391 ms] 
[1392 ms] 
[1392 ms] Extensions cache, copy to remote: None
[1393 ms] Start: Run in container: /root/.vscode-server/bin/b7886d7461186a5eac768481578c1d7ca80e2d21/bin/code-server --log debug --force-disable-user-env --server-data-dir /root/.vscode-server --use-host-proxy --telemetry-level all --accept-server-license-terms --host 127.0.0.1 --port 0 --connection-token-file /root/.vscode-server/data/Machine/.connection-token-b7886d7461186a5eac768481578c1d7ca80e2d21 --extensions-download-dir /root/.vscode-server/extensionsCache --start-server --disable-websocket-compression
[2633 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'
Merged:    '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
[2650 ms] *
* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*
[2724 ms] Server bound to 127.0.0.1:41047 (IPv4)
Extension host agent listening on 41047

[2725 ms] Start: Run in container: echo 41047 >'/root/.vscode-server/data/Machine/.devport-b7886d7461186a5eac768481578c1d7ca80e2d21'
[2729 ms] 
[2729 ms] 
[2730 ms] Port forwarding for container port 41047 starts listening on local port.
[2730 ms] Port forwarding local port 41047 to container port 41047
[2731 ms] Start: Run in container: mkdir -p '/root/.vscode-server/data/Machine' && CONTENT="$(cat '/root/.vscode-server/data/Machine/.onCreateCommandMarker' 2>/dev/null || echo ENOENT)" && [ "${CONTENT:-2023-04-05T12:34:17.233695392Z}" != '2023-04-05T12:34:17.233695392Z' ] && echo '2023-04-05T12:34:17.233695392Z' > '/root/.vscode-server/data/Machine/.onCreateCommandMarker'
[2825 ms] 
[2825 ms] 
[2825 ms] Exit code 1
[2826 ms] Start: Run in container: mkdir -p '/root/.vscode-server/data/Machine' && CONTENT="$(cat '/root/.vscode-server/data/Machine/.updateContentCommandMarker' 2>/dev/null || echo ENOENT)" && [ "${CONTENT:-2023-04-05T12:34:17.233695392Z}" != '2023-04-05T12:34:17.233695392Z' ] && echo '2023-04-05T12:34:17.233695392Z' > '/root/.vscode-server/data/Machine/.updateContentCommandMarker'
[2896 ms] 
[2896 ms] 
[2896 ms] Exit code 1
[2896 ms] Start: Run in container: mkdir -p '/root/.vscode-server/data/Machine' && CONTENT="$(cat '/root/.vscode-server/data/Machine/.postCreateCommandMarker' 2>/dev/null || echo ENOENT)" && [ "${CONTENT:-2023-04-05T12:34:17.233695392Z}" != '2023-04-05T12:34:17.233695392Z' ] && echo '2023-04-05T12:34:17.233695392Z' > '/root/.vscode-server/data/Machine/.postCreateCommandMarker'
[2897 ms] Start: Run in container: /bin/sh -c # Watch installed extensions
[2898 ms] Start: Run in container: /bin/sh -c # Watch machine settings
[2979 ms] 
[2979 ms] 
[2979 ms] Exit code 1
[2980 ms] Start: Run in container: # Test for /root/.gitconfig and git
[2997 ms] git not found
[2998 ms] 
[2998 ms] Exit code 1
[2999 ms] Start: Run in container: command -v git >/dev/null 2>&1 && git config --global --replace-all credential.helper '!f() { /root/.vscode-server/bin/b7886d7461186a5eac768481578c1d7ca80e2d21/node /tmp/vscode-remote-containers-6676f2560f420853fccf567487f4bb065b823c8a.js $*; }; f' || true
[3004 ms] 
[3004 ms] 
[3004 ms] Start: Run in container: mkdir -p '/root/.vscode-server/data/Machine' && CONTENT="$(cat '/root/.vscode-server/data/Machine/.postStartCommandMarker' 2>/dev/null || echo ENOENT)" && [ "${CONTENT:-2023-04-05T12:50:42.267200665Z}" != '2023-04-05T12:50:42.267200665Z' ] && echo '2023-04-05T12:50:42.267200665Z' > '/root/.vscode-server/data/Machine/.postStartCommandMarker'
[3015 ms] Port forwarding connection from 43304 > 41047 > 41047 in the container.
[3016 ms] Start: Run in container: /root/.vscode-server/bin/b7886d7461186a5eac768481578c1d7ca80e2d21/node -e 
[3227 ms] 
[3227 ms] 
[4285 ms] Port forwarding 43304 > 41047 > 41047 stderr: Connection established
[5198 ms] [12:50:52] 

[5675 ms] [12:50:52] Extension host agent started.
[6050 ms] Port forwarding connection from 43310 > 41047 > 41047 in the container.
[6050 ms] Start: Run in container: /root/.vscode-server/bin/b7886d7461186a5eac768481578c1d7ca80e2d21/node -e 
[6293 ms] [12:50:53] No uninstalled extensions found.
[6355 ms] [12:50:53] [127.0.0.1][46314d0d][ManagementConnection] New connection established.
[6588 ms] [12:50:53] Log level changed to info
[7453 ms] Port forwarding 43310 > 41047 > 41047 stderr: Connection established
[8985 ms] [12:50:56] [127.0.0.1][81f4381c][ExtensionHostConnection] New connection established.
[9255 ms] [12:50:56] [127.0.0.1][81f4381c][ExtensionHostConnection] <503> Launched Extension Host Process.
[11466 ms] Extensions cache, remote removals: None
[69692 ms] Start: Run in container: /bin/sh -c # Watch machine settings
[70267 ms] Start: Run in container: /bin/sh -c # Watch installed extensions
[71503 ms] Extensions cache, remote removals: None
[131544 ms] Extensions cache, remote removals: None
[135521 ms] Start: Run in container: /bin/sh -c # Watch machine settings
[136841 ms] Start: Run in container: /bin/sh -c # Watch installed extensions
chrmarti commented 1 year ago

We remember the last workspace folder used when attaching to a container of a certain image. I guess the folder / workspace is no longer there in the new container. We could look into the container to check if the folder is still there before we reopen the window.

mohamedGamalAbuGalala commented 1 year ago

Any luck solving this?

im-calvin commented 1 year ago

Also running into the same issue here!

amadeann commented 5 months ago

This trips me up each time after I try to set up Laravel Sail (Docker-based) project after a break :) In my case, I just need to select the folder in the container that I want to get opened as "workspace":

open_workspace