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.64k stars 285 forks source link

Docker container not found by Remote Containers, found by Docker extension but not able to attach to. #6093

Closed Infraviored closed 2 years ago

Infraviored commented 2 years ago

Does this issue occur when all extensions are disabled?: Yes/No

Steps to Reproduce:

  1. Download and Build the Docker container from https://github.com/Roboy/mujoco_roboy
  2. start the container. Verify it is running.
  3. in the Docker extension of VS Code, the container is running (Green play). The console can be attached to it, commands can be run.
  4. When trying to attach VS Code to the container there is a red-x-message: Error running command remote-containers.attachToRunningContainerFromViewlet: Unexpected end of JSON input. This is likely caused by the extension that contributes remote-containers.attachToRunningContainerFromViewlet.

When trying Remote-Containers: Attach to running container... It says: There are no running containers to attach to.

Does this have sth to do with the Docker container?

Help is greatly appreciated.

I must get the Debugger running

chrmarti commented 2 years ago

Could you attach the Container log after this failed? (F1 > Remote-Containers: Show Container Log)

github-actions[bot] commented 2 years ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

MohamedAli-M commented 2 years ago

@chrmarti Hello, I have the same problem as described. I tried to uninstall vscode and the ./vscode folder to delete all the extensions, but it still isn't working.

image

Here is the Container log.

chrmarti commented 2 years ago

@MohamedAli-M Are you trying to attach to an existing container? How do you create the container?

MohamedAli-M commented 2 years ago

Hello @chrmarti, thank you for your answer.

I am trying to attach to the container built from this repository : https://github.com/lajoiepy/argos3_docker_example

Here is the dockerfile i am using :

FROM ubuntu:18.04
LABEL Maintainer="Pierre-Yves Lajoie <pierre-yves.lajoie@polymtl.ca>"
LABEL argos-example.version="0.1"

# Install common dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    dpkg \ 
    git \
    pkg-config \
    python \
    python-dev \
    python-numpy \
    sudo \
    software-properties-common \
    && rm -rf /var/lib/apt/lists/*

# Install ARGoS dependencies
RUN apt-get update && apt-get install -y \
    wget \
    freeglut3-dev \
    qt5-default \
    libxi-dev \
    libxmu-dev \
    libfreeimage-dev \
    libfreeimageplus-dev \
    liblua5.2-dev \
    lua5.2 \
    liblua5.3-dev \
    lua5.3 \
    libboost-filesystem-dev \
    cmake \
    && rm -rf /var/lib/apt/lists/*

# Add dummy argument to force rebuild starting from that point
ARG UPDATE_ARGOS=unknown

# Install Argos from source
RUN cd /root/ &&\
    git clone https://github.com/MISTLab/argos3.git &&\
    cd argos3 &&\
    git checkout inf3995 &&\
    mkdir build_simulator &&\
    cd build_simulator &&\
    cmake ../src -DCMAKE_BUILD_TYPE=Debug \
     -DARGOS_BUILD_FOR=simulator \
     -DARGOS_THREADSAFE_LOG=ON \
     -DARGOS_DYNAMIC_LOADING=ON &&\
    make -j $(nproc)
RUN touch /root/argos3/build_simulator/argos3.1.gz &&\
    touch /root/argos3/build_simulator/README.html &&\
    cd /root/argos3/build_simulator &&\
    make install
RUN chmod +x /root/argos3/build_simulator/argos_post_install.sh &&\
    ./root/argos3/build_simulator/argos_post_install.sh &&\
    echo "\nsource /root/argos3/build_simulator/setup_env.sh\n" >> /.bashrc

#################################
#          YOUR CODE            #
#################################

# Add dummy argument to force rebuild starting from that point
# ARG UPDATE_CODE=unknown

RUN echo "cd /root/src &&\
    mkdir build && cd build &&\
    cmake -DCMAKE_BUILD_TYPE=Debug .. &&\
    make -j $(nproc)" >> /launch-script.sh

RUN echo "cd /root/src && argos3 -c experiments/crazyflie.argos" >> /launch-script.sh

RUN chmod +x /launch-script.sh

# ENTRYPOINT ["/launch-script.sh"]

And here is the file I made to run the docker image (I use x11Docker) ;

#!/bin/bash

XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth
xhost +local:docker

x11docker --fullscreen --interactive --hostnet --user=RETAIN -- --privileged -v "$PWD/src:/root/src" -- argos

I can access the shell via remote container, but I am unable to directly attach it to vscode.

chrmarti commented 2 years ago

@MohamedAli-M Is the container shown when you use F1 > Remote-Containers: Attach to Running Container...?

github-actions[bot] commented 2 years ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!