For Phase B.1 of the E2E test split, this document outlines the research findings and approach for implementing Docker container-based configuration testing to replace LXD VM-based testing for the configuration, release, and run phases.
- Current Issue: LXD VMs work for provisioning but fail during configuration phase due to network connectivity issues within VMs on GitHub Actions runners
- Root Cause: GitHub Actions runners are themselves VMs, creating nested virtualization issues that prevent network connectivity required for software installation
- Solution: Split testing into provision (LXD VMs) and configuration (Docker containers) phases
Based on analysis of the current E2E workflow, the configuration tests need to validate:
- Docker Installation: Via Ansible playbook
install-docker.yml - Docker Compose Installation: Via Ansible playbook
install-docker-compose.yml - APT Cache Updates: Via
update-apt-cache.yml - Network connectivity: For package downloads
- Cloud-init completion: Verify initialization completed
- Docker service: Verify Docker daemon is running
- Docker Compose: Verify Docker Compose binary is functional
- SSH connectivity: Ensure Ansible can connect and execute commands
- Inventory management: Dynamic inventory generation with container IP
- SSH-based execution: Ansible connects via SSH to execute playbooks
- Privilege escalation: Requires
sudoaccess within container - Ubuntu 24.04 target: Current templates target Ubuntu 24.04 LTS
- Base Image: Ubuntu 24.04 LTS (to match current VM environment)
- SSH Server: OpenSSH server for Ansible connectivity
- Systemd: For service management (Docker daemon, etc.)
- Sudo Access: For privilege escalation during software installation
- Network Access: For package downloads and installations
- Init System: Alternative to cloud-init for container initialization
- Base:
ubuntu:24.04 - SSH Setup: Install and configure OpenSSH server
- Systemd: Enable systemd for service management
- User Setup: Create user with sudo access
- Network: Default Docker networking (sufficient for GitHub Actions)
- Base: Existing Ubuntu images with SSH enabled
- Pros: Faster setup, less maintenance
- Cons: Less control, may not match exact VM environment
Since cloud-init is VM-specific, containers need alternative initialization:
- Container Init Scripts: Custom initialization via entrypoint script
- SSH Key Injection: Mount SSH keys via Docker volumes or copy
- User Provisioning: Direct user/key setup instead of cloud-init
- Service Initialization: Direct systemd service management
- Virtualization Support Research: Comprehensive testing of virtualization tools on GitHub Actions, demonstrating Docker feasibility
- Docker-in-VM Test Repository: Specific research on Docker installation within VMs on GitHub Actions runners, documenting the network connectivity issues
- GitHub Actions Runner Images Issue #13003: Network connectivity issues with LXD VMs on GitHub runners
- Original Virtualization Investigation: Background context on GitHub Actions virtualization support
- Container Lifecycle Management: Automatic startup/cleanup
- Network Management: Automatic port mapping and network configuration
- Integration: Well-integrated with Rust testing ecosystem
- Parallel Testing: Multiple containers can run in parallel
- Generic Image: Use
testcontainers::GenericImagefor Ubuntu container - Custom Configuration: Configure SSH, systemd, and networking
- Volume Mounting: SSH keys and test artifacts
- Port Mapping: SSH port (22) mapping for Ansible connectivity
- Simpler Setup: Direct
docker runcommands - Less Dependencies: No additional crates required
- Manual Management: Explicit container lifecycle management
- More Control: Direct control over Docker operations
- SSH Access: Container must accept SSH connections
- Port Mapping: Map container SSH port to host
- IP Address: Deterministic container IP for Ansible inventory
- DNS Resolution: Container must resolve package repositories
- Docker Networking: Works reliably on GitHub Actions
- Port Mapping: Standard Docker port mapping supported
- Internet Access: Containers have internet access for package downloads
- No Nested Virtualization: Avoids the LXD VM networking issues
- Docker Configuration: Create
docker/provisioned-instance/Dockerfile - Container Setup: Ubuntu 24.04 with SSH, systemd, sudo user
- Integration Strategy: Document testcontainers vs direct Docker approach
- Network Requirements: Document Ansible connectivity requirements
- Cloud-init Alternative: Design container initialization approach
- Docker Implementation: Build and test Docker configuration
- Binary Creation: Implement
e2e-config-and-release-testsbinary - Container Management: Integrate container lifecycle with tests
- Local Testing: Validate complete workflow locally
- CI Integration: Create GitHub Actions workflow
┌─────────────────────────────────────────────────────────┐
│ GitHub Actions Runner │
│ ┌─────────────────────────────────────────────────────┐│
│ │ e2e-config-and-release-tests binary ││
│ │ ┌─────────────────────────────────────────────────┐ ││
│ │ │ Docker Container │ ││
│ │ │ ┌─────────────────────────────────────────────┐ │ ││
│ │ │ │ Ubuntu 24.04 LTS │ │ ││
│ │ │ │ - SSH Server (port 22) │ │ ││
│ │ │ │ - Systemd (service management) │ │ ││
│ │ │ │ - Sudo user (ansible connectivity) │ │ ││
│ │ │ │ - Package management (apt) │ │ ││
│ │ │ └─────────────────────────────────────────────┘ │ ││
│ │ └─────────────────────────────────────────────────┘ ││
│ │ ▲ ││
│ │ │ SSH Connection ││
│ │ ▼ ││
│ │ ┌─────────────────────────────────────────────────┐ ││
│ │ │ Ansible Client │ ││
│ │ │ - install-docker.yml │ ││
│ │ │ - install-docker-compose.yml │ ││
│ │ │ - inventory generation │ ││
│ │ └─────────────────────────────────────────────────┘ ││
│ └─────────────────────────────────────────────────────┘│
└─────────────────────────────────────────────────────────┘
- Docker Support: Well-established and reliable on GitHub Actions
- Network Connectivity: Docker containers have consistent internet access
- Package Installation: No nested virtualization issues
- Systemd in Containers: May require special configuration
- SSH Setup: Need to ensure SSH server starts correctly
- Performance: Container overhead vs VM performance
- Systemd: Use proven systemd-in-Docker patterns
- SSH Testing: Validate SSH connectivity in local testing phase
- Documentation: Comprehensive troubleshooting documentation
Docker containers provide a viable and reliable alternative to LXD VMs for configuration testing. The approach addresses the core network connectivity issues while maintaining compatibility with the existing Ansible-based configuration workflow. The implementation should start with a custom Ubuntu 24.04 Dockerfile and consider testcontainers-rs integration for better test lifecycle management.