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 approach allows offline or air-gapped environments to activate extensions and is also necessary for proprietary extensions that should not be published publicly, without requiring access to the Open VSX registry.

Procedure

  1. Place your .vsix extension files into a local folder, such as extensions/ inside a cloned .devopsconfig repository:
    This allows offline environments to access the extensions without connecting to the Open VSX registry.
  2. Reference the local .vsix files in your dev container configuration file (devcontainer.json):

    devcontainer.json example:

    {
      "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"
          ]
        }
      }
    }
    You can specify the exact version of each extension you want to install and control updates centrally.
  3. Update your Dockerfile to copy the extensions folder into the container during build:

    Dockerfile example:

    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"]
    This ensures the extensions are installed automatically when the container is set up.
  4. Build and run the dev container:
    The extension manager will detect the local .vsix files and install them during container startup.

Results

You have successfully installed and activated extensions in your dev container using local .vsix files. The extensions are now immediately available for use.