As seen in a recent PR (#153), the current pattern for editing important variables like $PATH are highly dependent on the technique the author chose to employ (editing *rc files, containerEnv properties), as well as the order in which both features and the declared variables are listed.
For consistency I believe we need to find a pattern (or perhaps invent some new attribute/concept in the devcontainer-feature.json) that allows us to safely and consistently apply container variables in a reproducible way.
The issue
Copied from #153 (comment)
I think this pattern that we've adopted here (using one containerEnv inside another) -might be dangerous moving forward, since I think that the order this object is emitted into the intermediate Dockerfile is important. Right now the tooling ends up emitting in the provided order



Notably, this output is different when using docker exec directly

Changing the order to:
"containerEnv": {
"PATH": "${PATH}:${CONDA_DIR}/bin",
"CONDA_SCRIPT":"${CONDA_DIR}/etc/profile.d/conda.sh",
"CONDA_DIR": "/opt/conda"
}
The auto-generated test fails:





cc JP Ungaretti (@jungaretti) @devcontainers/maintainers
As seen in a recent PR (#153), the current pattern for editing important variables like
$PATHare highly dependent on the technique the author chose to employ (editing*rcfiles,containerEnvproperties), as well as the order in which both features and the declared variables are listed.For consistency I believe we need to find a pattern (or perhaps invent some new attribute/concept in the
devcontainer-feature.json) that allows us to safely and consistently apply container variables in a reproducible way.The issue
I think this pattern that we've adopted here (using one containerEnv inside another) -might be dangerous moving forward, since I think that the order this object is emitted into the intermediate Dockerfile is important. Right now the tooling ends up emitting in the provided order
Notably, this output is different when using docker exec directly

Changing the order to:
The auto-generated test fails:

cc JP Ungaretti (@jungaretti) @devcontainers/maintainers