-
Notifications
You must be signed in to change notification settings - Fork 5.9k
code-server --install-extension causes earlier extensions to be removed from extensions.json in layered Docker builds #7326
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
Comments
We delegate this command to VS Code itself so it is probably an upstream bug, but maybe there is some issue in the way we call it or the way we configure the data directory. I was not able to reproduce with these two Dockerfiles (I had to change the marketplace because Open VSX is currently down, but I omitted that part):
Doing so shows me both extensions in the I also ran code-server with What does your |
hey @code-asher thanks for your tests. Perhaps there's something being changed in the environment when I install the code-server extensions. I'm installing them through a private devcontainer feature -
This is the # Check if running as vscode, if not, switch to vscode to install the extensions
if [ "$(whoami)" != "vscode" ]; then
SCRIPT_PATH="$(realpath "$0")"
echo "Not running as vscode, attempting to switch user..."
exec su - vscode -l -c "EXTENSION_IDS='$EXTENSION_IDS' \"$SCRIPT_PATH\" $*"
fi
printenv
echo "Existing installed extensions:"
code-server --list-extensions --show-versions
IFS=',' read -ra EXTENSION_IDS <<< "$EXTENSION_IDS"
for EXTENSION in "${EXTENSION_IDS[@]}"; do
echo "Installing code-server extension: $EXTENSION"
RETRIES=4 # Number of retries
WAIT_TIME=2 # Waiting time in seconds between retries
until [ $RETRIES -le 0 ]; do
code-server --install-extension "$EXTENSION" && break
RETRIES=$((RETRIES-1))
echo "Failed to install $EXTENSION, retrying in $WAIT_TIME seconds..."
sleep $WAIT_TIME
done
if [ $RETRIES -le 0 ]; then
echo "Failed to install $EXTENSION after multiple attempts."
else
echo "$EXTENSION installed successfully."
fi
done
# If there are no extensions to install, print a message
if [ ${#EXTENSION_IDS[@]} -eq 0 ]; then
echo "No extensions to install."
fi
# Print installed extensions
code-server --list-extensions --show-versions
|
Hmm I created a new directory with the following {
"image": "code-server-base",
"features": {
"./test-feature": {
"version": "1.0.0"
}
},
"forwardPorts": [8080]
}
{
"id": "test",
"version": "1.0.0",
"name": "test"
}
printenv
code-server --list-extensions --show-versions
code-server --install-extension editorconfig.editorconfig
code-server --list-extensions --show-versions Then I ran: $ devcontainer up --workspace-folder .
$ devcontainer exec --workspace-folder . code-server --list-extensions --show-versions
editorconfig.editorconfig@0.17.2
vscodevim.vim@1.29.0 So, I am seeing both the extension from the base image and the one installed by my feature. If you are able to drop a minimal reproduction I can run it and hopefully find the issue, but I think it is probably safe to say it is not a code-server or VS Code bug. |
Is there an existing issue for this?
OS/Web Information
When building a Docker image for code-server in multiple layers, I install a set of extensions in a base image using code-server --install-extension. In a later image that builds on this base, I install additional extensions. However, I’ve observed that only the most recently installed extensions remain listed in ~/.local/share/code-server/User/extensions.json. Earlier ones get removed from the file, even though their directories still exist under extensions/.
Steps to Reproduce
Expected
All installed extensions (across layers) should be retained and visible in extensions.json.
Actual
Only extensions from the last --install-extension step are listed; others are silently dropped.
Logs
Screenshot/Video
No response
Does this bug reproduce in native VS Code?
I did not test native VS Code
Does this bug reproduce in GitHub Codespaces?
I did not test GitHub Codespaces
Are you accessing code-server over a secure context?
Notes
No response
The text was updated successfully, but these errors were encountered: