Skip to content

Add Docker subcommand with cross-platform container execution#727

Closed
nchapagain001 wants to merge 9 commits into
microsoft:mainfrom
nchapagain001:users/nchapagain/vc-docker-subcommand-and-image-inspection
Closed

Add Docker subcommand with cross-platform container execution#727
nchapagain001 wants to merge 9 commits into
microsoft:mainfrom
nchapagain001:users/nchapagain/vc-docker-subcommand-and-image-inspection

Conversation

@nchapagain001

Copy link
Copy Markdown
Contributor

Summary

Adds the docker subcommand to VirtualClient, enabling workload profiles to run
inside Docker containers with automatic cross-platform support.

  • ./VirtualClient docker --image=ubuntu:noble --profile=GET-STARTED-OPENSSL.json
    routes all profile action components into the container via docker exec
  • Platform detection via docker image inspect sets VC_DOCKER_PLATFORM and
    VC_DOCKER_ARCH so package resolution uses container binaries (e.g., linux-x64)
    even when the host is Windows
  • Profiles containing DockerExecution are rejected immediately with a clear error
    ("double Docker") — the docker subcommand handles routing transparently

What Changed

  • DockerCommand.cs — new docker CLI subcommand: creates container, installs
    deps on host (volume-mounted into container), then executes each profile action via
    docker exec <id> /app/VirtualClient.Main --component={type}; validates profile has
    no DockerExecution before any container is created
  • DockerContainerClient.cs — new Docker client with CreateContainerAsync,
    ExecuteInContainerAsync, InspectImageAsync, and ParsePlatformFromInspectJson
  • DockerExecution.cs — component for standalone container execution (when
    VC_DOCKER_CONTAINER_ID is set externally, without the docker subcommand)
  • VirtualClientComponent.csPlatform, CpuArchitecture, and
    PlatformArchitectureName now check VC_DOCKER_PLATFORM/VC_DOCKER_ARCH env vars
    first, so IsSupported() and ToPlatformSpecificPath() evaluate against container
    platform rather than host platform

Test Plan

  • dotnet test — all existing tests pass
  • dotnet test --filter DockerContainerClientTests — 13 parser tests pass
  • dotnet test --filter VirtualClientComponentTests — 38 component tests pass
  • Manual: VirtualClient docker --image=ubuntu:noble --profile=GET-STARTED-OPENSSL.json --iterations=1 logs docker exec in output
  • Manual: VirtualClient docker --image=ubuntu:noble --profile=PERF-OPENSSL-DOCKER.json fails immediately with double-Docker error

Nirjan Chapagain and others added 9 commits June 15, 2026 16:12
- Use dism with elevated PowerShell to enable Windows containers feature on both Desktop and Server
- Profile INSTALL-DOCKER.json successfully enables Hyper-V containers on Windows Desktop and Server
- Windows containers feature is prerequisite for Docker Desktop and Windows Server Docker
- Simplified Windows path to focus on enabling the feature; Docker engine installation on Desktop should use Docker Desktop installer
- Remove Windows Docker support (containers feature setup)
- Profile INSTALL-DOCKER.json now Linux-only (Ubuntu)
- Removed Windows-specific tests; kept 2 Linux tests
- Cleaner implementation focused on single platform
…penssl-profile

Add Docker integration: CLI mode and DockerExecution wrapper component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant