'Open soure code' in VS Code Error | Isaac Sim in AWS EC2 instance

Hi,

Found an earlier post from 2022 about the same issue but doesn’t solve the problem.

I am attaching the video that leads to an error when I click Open Source Code in Isaac Sim.
These are the steps that I do to attach VS code to Isaac Sim Container:

  1. Connect to AWS EC2 instance.
  2. SSH through VS code to connect to the instance.
  3. Start the Isaac Sim docker using:
docker run -v /home/ubuntu/files:/Documents --name isaac-sim --entrypoint bash -it --gpus all -e "ACCEPT_EULA=Y" --rm --network=host \
    -e "PRIVACY_CONSENT=Y" \
    -e "FASTRTPS_DEFAULT_PROFILES_FILE=/home/ubuntu/IsaacSim-ros_workspaces/humble_ws/fastdds.xml" \
    -e "RMW_IMPLEMENTATION=rmw_fastrtps_cpp" \
    -e "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/isaac_sim/exts/omni.isaac.ros2_bridge/humble/lib" \
    -v ~/docker/isaac-sim/cache/kit:/isaac-sim/kit/cache:rw \
    -v ~/docker/isaac-sim/cache/ov:/root/.cache/ov:rw \
    -v ~/docker/isaac-sim/cache/pip:/root/.cache/pip:rw \
    -v ~/docker/isaac-sim/cache/glcache:/root/.cache/nvidia/GLCache:rw \
    -v ~/docker/isaac-sim/cache/computecache:/root/.nv/ComputeCache:rw \
    -v ~/docker/isaac-sim/logs:/root/.nvidia-omniverse/logs:rw \
    -v ~/docker/isaac-sim/data:/root/.local/share/ov/data:rw \
    -v ~/docker/isaac-sim/documents:/root/Documents:rw \
    nvcr.io/nvidia/isaac-sim:4.0.0
  1. Attach VS Code to the container.
  2. Install VS Code Extension ‘Isaac Sim VS Code edition’.
  3. Run ./runheadless.native.sh and enable omni.isaac.vscode in the isaac sim.
  4. Now clicking on any ‘Open Source code’ in Isaac Sim shows the error in terminal
/bin/sh: 1: code: not found
2024-08-09 07:15:59 [755,152ms] [Warning] [omni.isaac.vscode.ui_builder] Serving at 0.0.0.0:8226

Unable to launch VS Code (error code: 127).
Make sure VS Code is installed and accessible on the system via the command 'code'

Please do let me know if you have any questions to replicate this or need more information.

Thank you!

To solve this problem, you should install VS Code to your container.
Example Dockerfile is below

FROM nvcr.io/nvidia/isaac-sim:4.1.0

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && \
    apt-get install -y wget apt-transport-https software-properties-common

RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg && \
    install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/ && \
    rm -f packages.microsoft.gpg

RUN sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'

RUN apt-get update && \
    apt-get install -y code

RUN echo '#!/bin/bash\n /usr/bin/code --user-data-dir="/root/.config/Code" --no-sandbox "$@"' > /usr/local/bin/code && \
    chmod +x /usr/local/bin/code

ENTRYPOINT ["/bin/bash"]

/usr/local/bin/code is a bash file that allows the root user to use code.
This should allow you to use “Open source code” with Isaac Sim as root user.