okteto / remote-kubernetes

Remote Kubernetes Development in VS Code with Okteto
Apache License 2.0
74 stars 15 forks source link

In development containers, environment variables are inherited from the base image, with the exception of PATH. #228

Open david9991 opened 1 year ago

david9991 commented 1 year ago

Description of the Issue In the development container, environment variables inherit from the base image by default, except the PATH variable which is overridden by Okteto.

Steps to Reproduce Dockerfile:

FROM --platform=linux/amd64 rust as dev

RUN rustup target add aarch64-unknown-linux-gnu
RUN rustup toolchain install stable-aarch64-unknown-linux-gnu

okteto.yml:

namespace: okteto
build:
  testrust:
    dockerfile: Dockerfile
    image: xxx/testrust
    target: dev
dev:
  testrust:
    sync:
      - .:/usr/src/app
    image: ${OKTETO_BUILD_TESTRUST_IMAGE}
    autocreate: true

After building and running with Okteto, executing rustup for cargo in the development container was not possible because Okteto had overridden the PATH set in the rust base image.

Expected behavior The specified PATH in the development container built by Okteto should be appended to the end of the PATH from the base image, instead of overriding it.

Desktop (please complete the following information):

Additional context

david9991 commented 1 year ago

It seems that the PATH is being overridden by either the Okteto VSCode extension (Remote-Kubernetes) or the code-server. There are no issues with the standalone Okteto environment.

pchico83 commented 1 year ago

It seems that the PATH is being overridden by either the Okteto VSCode extension (Remote-Kubernetes) or the code-server. There are no issues with the standalone Okteto environment.

@david9991 based on it, I transferred the issue to this repo https://github.com/okteto/remote-kubernetes

rberrelleza commented 1 year ago

@david9991 what is the value of $PATH that you are seeing? I used your repro and this is what I'm seeing from within the container:

# echo $PATH
/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# rustup --version
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.69.0 (84c898d65 2023-04-16)`
# 
david9991 commented 1 year ago

Sorry for the delayed response. In the integrated terminal of the remote window, the PATH variable is being overridden. Here is my $PATH variable:

Screenshot 2023-05-26 at 12 45 15

Here is the one in the local window, which is OK.

Screenshot 2023-05-26 at 12 53 55