Skip to content

PATH environment variable overwritten in version 4.0.1 using Docker image #4699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
avouacr opened this issue Jan 7, 2022 · 5 comments
Closed

Comments

@avouacr
Copy link

avouacr commented Jan 7, 2022

OS/Web Information

  • Web Browser: Firefox 95.0.1
  • Local OS: Ubuntu 20.04
  • Remote OS:
  • Remote Architecture:
  • code-server --version: 4.0.1

Steps to Reproduce

The problem can be reproduced by building the following minimal Docker image :

FROM codercom/code-server:4.0.1
ENV PATH="/home/coder/local/bin/conda/bin:${PATH}"
RUN echo $PATH

and running it as a local server in the browser as explained in the installation guide.

Expected

When opening a terminal in VSCode, the value of $PATH should be the same as the one echoed at the end of the docker build step. The behavior is correct when building the image from code-server:3.12.0.

Actual

When building from code-server:4.0.1, the $PATH variable gets overwritten with the following path /usr/lib/code-server/vendor/modules/code-oss-dev/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games. If I run an interactive shell in the docker image using docker exec, the $PATH is as expected. But when opening VSCode in the browser, it is incorrect. I don't see any command in the entrypoint.sh script which modifies this variable.

Thank's for this great software.

@jsjoeio
Copy link
Contributor

jsjoeio commented Jan 7, 2022

@code-asher any ideas what might have been introduced that would modify the $PATH? 🤔

@jsjoeio jsjoeio added the needs-investigation This issue needs to be further investigated label Jan 7, 2022
@code-asher
Copy link
Member

code-asher commented Jan 10, 2022 via email

@rafipiccolo
Copy link

rafipiccolo commented Feb 22, 2022

i have configured git hooks. if i can't set the PATH correctly my hooks dont work and i cant use vscode git gui.

i tried to set the PATH system wide

RUN echo PATH=xxx >> /etc/environment

checked it works with

docker exec -ti vscode env

its ok. it prints the desired version of the path

but i see no changes in vscode terminal.
even if i had added this to settings.json

    "terminal.integrated.inheritEnv": true,

and my git hooks still doent work :(

anybody has a workarround ?

EDIT:
Its a fat shame, but i ended creating symbolic links to my binaries in /bin
at least now my hooks work.

@avouacr
Copy link
Author

avouacr commented Feb 24, 2022

@rafipiccolo

our workaround for the time being :

ENV PATH=xxxx
RUN echo "export PATH=$PATH" >> /home/coder/.bashrc 

which sets the correct $PATH provided $SHELL is set to /bin/bash, which it is by default.

@code-asher
Copy link
Member

We started discussing the cause in a duplicate issue #5621 so I am going to close this one as there is now more information in #5621.

@code-asher code-asher removed the needs-investigation This issue needs to be further investigated label Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants