Skip to content

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

Closed

Description

@avouacr

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.

Activity

  1. jsjoeio commented on Jan 7, 2022

    @jsjoeio
    Contributor

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

  2. code-asher commented on Jan 10, 2022

    @code-asher
    Member
  3. rafipiccolo commented on Feb 22, 2022

    @rafipiccolo

    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.

  4. avouacr commented on Feb 24, 2022

    @avouacr
    Author

    @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.

  5. code-asher commented on Oct 5, 2022

    @code-asher
    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions