Loading extensions from local .vsix files
Using Code, you can install and activate extensions in an offline or air-gapped environment by loading them from local .vsix files specified in the dev container configuration.
About this task
You can load extensions from a local .vsix file by specifying a relative path. This method enables offline or airgapped environments to activate extensions without requiring access to the Open VSX registry.
Procedure
-
Place your .vsix extension files into a local folder, such as
extensions/:
This allows offline environments to access the extensions without connecting to the Open VSX registry.
-
Reference the local .vsix files in your dev container configuration file
(devcontainer.json):
You can specify the exact version of each extension you want to install and control updates centrally.
-
Update your Dockerfile to copy the extensions folder into the container during
build:
This ensures the extensions are installed automatically when the container is set up.
-
Build and run the dev container:
The extension manager will detect the local .vsix files and install them during container startup.
Example Dev Container Setup with Offline Extensions
Dockerfile:
FROM mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y sudo curl git gnupg pass pinentry-tty && \
apt-get clean
RUN curl -fsSL https://github.com/git-ecosystem/git-credential-manager/releases/download/v2.6.1/gcm-linux_amd64.2.6.1.tar.gz -o gcm.tar.gz \
&& tar -xvf gcm.tar.gz -C /usr/local/bin \
&& rm -rf gcm.tar.gz \
&& git-credential-manager configure
RUN curl -fsSL https://code-server.dev/install.sh | sh -s -- --version=4.103.2
COPY extensions /opt/extensions/
USER 1001
CMD ["tail", "-f", "/dev/null"]
devcontainer.json:
{
"name": "Node",
"description": "Node codeserver environment with offline extensions",
"build": {
"dockerfile": "./Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"IBM.wca-core-1.6.2.vsix",
"ms-python.python-2025.14.0.vsix"
]
}
}
}
Results: You have successfully installed and activated extensions in your dev container using local .vsix files. The extensions are now immediately available for use within your offline or air-gapped development environment.
