openvscode-server icon indicating copy to clipboard operation
openvscode-server copied to clipboard

PATH changed for terminal process

Open rotemso opened this issue 3 years ago • 3 comments

Hello, I'm using the openvscode-server (currently with version 1.65.0) within my own docker image. I'm defining the PATH environment variable within my own Dockerfile.

When I'm running the docker container, openvscode-server is loaded correctly but when I try to open a new Terminal I see that its PATH was somehow overwritten:

When I type: > echo $PATH I get: <openvscode-server root>/bin/remote-cli:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

None of these values were defined by me in the Dockerfile.

When I access the running container using docker exec command and try the same echo $PATH - the path I get is correct according to what I have defined in the Dockerfile.

So it seems that the PATH for the Terminal process is somehow changed.

Can you please tell why this happens and how to change this? I couldn't see any configuration / script that is doing that.

With that, as the <openvscode-server root>/bin/remote-cli is added to path I guess it is added somehow by openvscode-server.

Thanks, Rotem

rotemso avatar Mar 13 '22 16:03 rotemso

Hi @rotemso, how are you are launching openvscode-server in the docker file? You can check how we launch it our dockerfile which correctly picks up env variables

RUN mkdir -p /home/openvscode-server/other_folder
ENV PATH="/home/openvscode-server/other_folder:${PATH}"

ENTRYPOINT [ "/bin/sh", "-c", "exec ${OPENVSCODE_SERVER_ROOT}/bin/openvscode-server --host 0.0.0.0 --without-connection-token \"${@}\"", "--" ]

jeanp413 avatar Mar 15 '22 01:03 jeanp413

Hi @jeanp413, thank you for your reply. I have in my dockerfile a definition of ENV PATH="<my_paths>:${PATH}"

Then in the docker entrypoint I have my own bash script:

COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]

And then in this entry point script I'm doing some operations (not related to PATH) and finally call:

/usr/local/bin/node <openvscode-server-root>/out/server-main.js --port=3000 --without-connection-token --host=0.0.0.0

As I have my own node installation in the docker image, I'm not calling the ${OPENVSCODE_SERVER_ROOT}/bin/openvscode-server, but I'm using the exact same code as triggered from this openvscode-server script (and I don't see anything related to PATH there anyway).

When I enter this docker container using docker exec I do see the PATH as I have defined in the dockerfile. But from vscode terminal the path is overwritten as I explained above.

Can you please assist me to understand what is missing? Is there some vscode customization needed to achieve using my own PATH as defined in dockerfile?

Thanks, Rotem

rotemso avatar Mar 16 '22 08:03 rotemso

I am having the same issue - v1.76.0, I have a docker container with a dotnet application as the entrypoint.

from the dotnet application I am launching the openvscode-server through a sub-process, pointing to the ${OPENVSCODE_SERVER_ROOT}/bin/openvscode-server <my_parameters> script as noted in the previous answer.

I can attach a ssh remote vscode instance to the container and it seems to append a similar remote-cli path to the $PATH

but it appends it to the correct $PATH, I can't figure out where the openvscode-server is getting it's $PATH to append....

I don't think I had this issue when downloading the tar directly into the dockerfile, but I recently switched to using COPY --from=gitpod/openvscode-server:1.76.0 /home/.openvscode-server <my_vscodeserver_location> and now I'm seeing this - not sure if that is relevant...

etabor20 avatar Mar 14 '23 19:03 etabor20