Skip to main content
COSMICBYTEZLABS
NewsSecurityHOWTOsToolsStudyTraining
ProjectsNewsletterHire MeAbout
Subscribe

Press Enter to search or Esc to close

News
Security
HOWTOs
Tools
Study
Training
Projects
Newsletter
Hire Me
About
RSS Feed
Reading List
Subscribe

Stay in the Loop

Get the latest security alerts, tutorials, and tech insights delivered to your inbox.

Subscribe NowFree forever. No spam.
COSMICBYTEZLABS

Your trusted source for IT intelligence, cybersecurity insights, and hands-on technical guides.

1184+ Articles
136+ Guides

CONTENT

  • Latest News
  • Security Alerts
  • HOWTOs
  • Checklists
  • Projects
  • Exam Prep

RESOURCES

  • Search
  • Browse Tags
  • Newsletter Archive
  • Reading List
  • RSS Feed

COMPANY

  • About Us
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CosmicBytez Labs. All rights reserved.

System Status: Operational
  1. Home
  2. Projects
  3. BC Docker Manager: An Electron + Next.js Desktop App for Business Central Containers
BC Docker Manager: An Electron + Next.js Desktop App for Business Central Containers
PROJECTAdvanced

BC Docker Manager: An Electron + Next.js Desktop App for Business Central Containers

Native Windows app for managing Business Central Docker containers — log viewer, backup tooling, AI-powered troubleshooting via Claude, and an HNS-error detector that recovers from Windows 11 24H2's networking quirks.

Dylan H.

Projects

May 5, 2026
4 min read
6-8 hours

Tools & Technologies

Electron 35Next.js 16electron-builderPowerShellDocker Desktop

Overview

Microsoft's BcContainerHelper is a great PowerShell module — until Windows 11 24H2 broke it with persistent HNS port conflicts. Rather than wait for a fix, this Electron app routes around the problem entirely: it talks to Docker directly, detects the specific HNS errors that 24H2 throws, and runs a one-click recovery sequence. It's also a perfectly capable container manager: list, create, start, stop, remove, view logs, run backups, and ask Claude what went wrong when something does.

Stack

  • Desktop: Electron 35
  • Frontend: Next.js 16 (App Router), React, TypeScript
  • Styling: Tailwind CSS with custom theme
  • Build: electron-builder (Windows installer + portable)
  • Testing: Jest + React Testing Library
  • Deployment: Electron Builder (local Windows app)

Key Features

  • BC Docker container management (list, create, start, stop, remove)
  • Container creation wizard with one-click deployment
  • Real-time log viewing
  • Backup and restore operations (PowerShell-based)
  • AI-powered troubleshooting chat (Claude API)
  • HNS (Host Network Service) error detection and automated recovery
  • Network diagnostics panel (orphaned endpoints, NAT mappings, port conflicts)
  • PowerShell script execution with real-time output streaming
  • Two deployment paths: direct Docker (primary) and BcContainerHelper (legacy)

Three-Layer Architecture

  1. Main Process (electron/main.js) — window management, IPC, PowerShell execution.
  2. Preload Script (electron/preload.js) — secure bridge between main and renderer.
  3. Frontend (Next.js App Router) — client components with a lib/electron-api.ts abstraction.

Dual API Mode

  • Electron Mode — uses IPC via window.electronAPI for Docker, backup, and AI operations.
  • Web Mode (fallback) — uses Next.js API routes via fetch.

This lets the same UI run in a browser for development without an Electron shell.

Container Naming

The app filters for containers matching the bcserver-* pattern. Anything else is hidden from the dashboard — keeps general Docker containers on the host out of the way.

Deployment Scripts

ScriptPurposeStatus
Deploy-BC-Container.ps1Direct Docker commands (bypasses BcContainerHelper)Primary
Install-BC-Helper.ps1BcContainerHelper with New-BcContainerLegacy — fails on Win11 24H2
Fix-HNS-State.ps1Aggressive HNS cleanup (requires admin)Recovery tool
Diagnose-HNS-Ports.ps1Non-destructive network diagnosticsDiagnostic tool
Backup-BC-Container.ps1Backup operationsOperational
Restore-BC-Container.ps1Restore operationsOperational

HNS Error Detection & Recovery

lib/hns-error-detector.ts parses PowerShell output for the specific error signatures Windows 11 24H2 surfaces:

  • Port Conflicts (0x803b0013)
  • HNS Endpoint Errors
  • NAT Mapping Conflicts
  • Service Failures

Recovery flow: error detected → HNSErrorRecovery component shown → Run Diagnostics → Clean HNS State → Retry Deployment. Roughly 90% of HNS failures clear on the first sweep.

Settings

Persistent settings live in %APPDATA%/bc-container-manager/settings.json:

SettingPurpose
anthropicApiKeyClaude API key for the troubleshooting chat
backupRootBackup directory path
autoRefreshIntervalDashboard refresh rate

Routes

RoutePurpose
/dashboardContainer list with status
/createContainer creation wizard
/settingsApp configuration
/backupsBackup management
/troubleshootAI-powered troubleshooting chat

Building for Distribution

npm run build                    # Build Next.js static export
npm run electron:build:win       # Build Windows installer
npm run electron:build:portable  # Build portable .exe

Output:

  • Installer: dist/BC Container Manager-Setup-1.0.0.exe
  • Portable: dist/BC Container Manager-Portable-1.0.0.exe

Requires icon files in assets/: icon.ico (Windows), icon.png (512x512).

Lessons Learned

  • BcContainerHelper fails on Windows 11 24H2 with persistent HNS 0x803b0013 errors — direct docker commands are more reliable.
  • shell.openExternal should be restricted to http/https only — anything else is a vector.
  • Settings updates need a whitelist on the main-process side. Don't let the renderer write arbitrary keys.
  • The Windows elevation dialog must respect Cancel. Treat user refusal as a real outcome, not an error to retry past.
  • Password fields need metacharacter checks before they hit a PowerShell command line.
  • PowerShell scripts touching HNS cmdlets require Administrator. Plan for the elevation prompt.
  • Docker Desktop must be running — surface that as a startup health check, not an obscure error twenty clicks deep.

CI/CD

build-test.yml runs on a Windows runner with Node 20: type-check → tests → electron:pack. ci.yml does lint and build checks. release.yml automates releases.

#Electron#Next.js#Business Central#Docker#Windows#PowerShell#Claude API

Related Articles

Pi-hole v6 + Unbound: Network-Wide DNS Sinkhole with Recursive Resolution

Deploy Pi-hole v6 as a network-wide DNS sinkhole backed by Unbound as a self-hosted recursive resolver — eliminating ads, trackers, and malware domains...

11 min read

Build a Production Monitoring Stack with Prometheus and Grafana

Deploy a full observability stack — Prometheus metrics collection, Grafana dashboards, AlertManager notifications, and three exporters — all containerized...

8 min read

How CosmicBytez Labs Is Built: Next.js 16, velite, and Resend

A meta writeup about this site — content pipeline via velite (the contentlayer2 successor), a Resend-backed newsletter wired through a Vercel cron, the IT exam prep with 770 practice questions across 11 cert tracks, and the 8-tool utility suite.

3 min read
Back to all Projects