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.63k stars 282 forks source link

Dev Containers downloads glibc Node server for Alpine host #10324

Open PythonCoderAS opened 3 days ago

PythonCoderAS commented 3 days ago

Type: Bug

I have a docker-compose file running a dind docker daemon container and an Alpine-Linux based vscode server tunnel container. On the vscode server tunnel, I am running a container with a simple shell (which is sleeping). However, trying to attach to the simple shell container while inside the vscode tunnel causes the following error to happen:

Error: CodeError(ProcessSpawnFailed(Os { code: 2, kind: NotFound, message: "No such file or directory" }))

Upon further investigation, this is because the Dev Container extension downloads a glibc-based node binary, which will not run on the Alpine vscode tunnel host.

ldd ~/.vscode-remote-containers/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/node
        /lib64/ld-linux-x86-64.so.2 (0x78a581ba2000)
        libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x78a581ba2000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x78a581909000)
        libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x78a581ba2000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x78a5818e5000)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x78a581ba2000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x78a581ba2000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /root/.vscode-remote-containers/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/node)
Error relocating /root/.vscode-remote-containers/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/node: fcntl64: symbol not found
Error relocating /root/.vscode-remote-containers/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/node: gnu_get_libc_version: symbol not found
Error relocating /root/.vscode-remote-containers/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/node: setcontext: symbol not found
Error relocating /root/.vscode-remote-containers/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/node: backtrace: symbol not found
Error relocating /root/.vscode-remote-containers/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/node: backtrace_symbols: symbol not found
Error relocating /root/.vscode-remote-containers/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/node: __register_atfork: symbol not found
Error relocating /root/.vscode-remote-containers/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/node: makecontext: symbol not found
Error relocating /root/.vscode-remote-containers/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/node: getcontext: symbol not found
Error relocating /root/.vscode-remote-containers/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/node: __libc_stack_end: symbol not found

Repro

Make a directory.

Inside of the directory, make a file called Dockerfile with the contents:

FROM alpine:latest

RUN apk add nodejs
RUN wget -O /tmp/vscode-server.tar.gz https://update.code.visualstudio.com/1.93.1/cli-alpine-x64/stable
RUN tar -xzf /tmp/vscode-server.tar.gz -C /tmp
RUN mv /tmp/code /usr/bin/code
RUN apk add docker-cli

WORKDIR /usr/local/vscode-server
CMD ["/usr/bin/code", "tunnel", "--accept-server-license-terms", "--install-extension", "ms-azuretools.vscode-docker"]

Make a file in the same directory called docker-compose.yml with the contents:

services:
  docker:
    image: docker:dind
    privileged: true
    environment:
      - DOCKER_TLS_CERTDIR=
      - DOCKER_TLS_VERIFY=
      - DOCKER_TLS=
  vscode-server:
    build: .
    environment:
      - DOCKER_HOST=tcp://docker:2375
      - VSCODE_CLI_DATA_DIR=/data

In the directory, open a terminal session and run docker compose up -d. Afterwards, run docker compose logs --follow vscode-server, and register the new tunnel.

Once the tunnel is registered, connect to it using the VSCode Desktop app, and open a terminal on the tunnel. In it, run:

docker run --rm -d alpine sh -c "while true; do sleep 1; done"

Open the Docker panel, and try to attach to this Alpine container. This causes the bug.

Extension version: 0.387.0 VS Code version: Code 1.93.1 (38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40, 2024-09-11T17:20:05.685Z) OS version: Darwin x64 23.5.0 Modes: Remote OS version: Linux x64 6.8.0-41-generic Connection to 'attached-container+7b22636f6e7461696e65724e616d65223a222f726f6d616e7469635f63616e6e6f6e222c2273657474696e6773223a7b22686f7374223a227463703a2f2f646f636b65723a32333735227d7d@tunnel+36f9c4694405' could not be established

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz (4 x 3600)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|4, 4, 4| |Memory (System)|32.00GB (2.35GB free)| |Process Argv|--crash-reporter-id 38cb80a1-7ebb-4254-8585-2bdd58f3f3c3| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|isolated-development| |OS|Linux x64 6.8.0-41-generic| |CPUs|Intel(R) Xeon(R) Silver 4216 CPU @ 2.10GHz (64 x 800)| |Memory (System)|187.52GB (178.27GB free)| |VM|0%| Connection to 'attached-container+7b22636f6e7461696e65724e616d65223a222f726f6d616e7469635f63616e6e6f6e222c2273657474696e6773223a7b22686f7374223a227463703a2f2f646f636b65723a32333735227d7d@tunnel+36f9c4694405' could not be established
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonnoceb:30805159 asynctok:30898717 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 jg8ic977:31013176 a69g1124:31058053 dvdeprecation:31068756 dwnewjupyter:31046869 impr_priority:31102340 nativerepl1:31139838 refactort:31108082 pythonrstrctxt:31112756 flighttreat:31134774 wkspc-onlycs-t:31132770 wkspc-ranged-c:31125598 cf971741:31144450 autoexpandse:31146404 ei213698:31121563 iacca2:31144504 notype1cf:31143046 5fd0e150:31146321 ```
chrmarti commented 3 days ago

Please append the Dev Containers log from when this happens. (F1 > Dev Containers: Show Container Log)

PythonCoderAS commented 2 days ago

These are all the logs I could get:

dev-container-remote-host-container.txt dev-container-remote-host.txt