Customizing the Development Container

This guide covers how to extend the Sol3 SDK development container with custom tools and configuration while preserving SDK upgradability.

Prerequisites

Adding Custom Packages

The SDK example uses a multi-stage Docker build, the first stage of which builds the development container.

Edit the following section of the Dockerfile to add custom packages to the devcontainer:

# ---------------------- BEGIN CUSTOMIZATION ---------------------------------
# Uncomment this section to further customize the devcontainer.
# ...
# ----------------------- END CUSTOMIZATION ----------------------------------

Adding Environment Variables

Add project-specific environment variables directly to the Dockerfile:

# ---------------------- BEGIN CUSTOMIZATION ---------------------------------
# Uncomment this section to further customize the devcontainer.
# ...

ENV CUSTOM_TOOL_PATH /opt/my-tool/bin

# ----------------------- END CUSTOMIZATION ----------------------------------

or in .devcontainer/devcontainer.json:

{
  "containerEnv": {
    "CUSTOM_TOOL_PATH": "/opt/my-tool/bin"
  }
}

Adding Bind Mounts

Mount additional host directories by modifying .devcontainer/devcontainer.json:

{
  "mounts": [
    "source=${HOME}/data,target=/workspace/data,type=bind",
    "source=${HOME}/config,target=/workspace/config,type=bind"
  ]
}

Hardware Device Access

Add access to custom hardware devices by modifying .devcontainer/devcontainer.json:

{
  "runArgs": ["--device=/dev/custom-device", "--device=/dev/ttyUSB0"]
}

VS Code Extensions

Add project-specific VS Code extensions by modifying .devcontainer/devcontainer.json:

{
  "customizations": {
    "vscode": {
      "extensions": [
        "ms-vscode.cpptools-extension-pack",
        "your-custom-extension-id"
      ]
    }
  }
}

Rebuilding the Container

After making changes to the Dockerfile or .devcontainer/devcontainer.json:

VS Code:

  1. Open Command Palette (Ctrl+Shift+P)

  2. Select “Dev Containers: Rebuild Container”

Command Line:

# Stop existing container
devcontainer down --workspace-folder .

# Rebuild and start with changes
devcontainer up --workspace-folder . --remove-existing-container

The container will rebuild with your custom configuration while preserving SDK functionality.