Hi Ben,
It’s great that you’re experimenting with the new devcontainer scaffold. Let’s go through your questions about the DevContainer:
Topic 1: Docker Desktop vs. WSL2 Daemon
You are correct that Docker Desktop will work and it’s a valid approach for running DevContainers and your CMF stack. The reason the official CM guides recommend setting up the Docker daemon inside of WSL2 (using a distribution like Ubuntu) is primarily due to licensing and performance.
Licensing: As you noted, Docker Desktop has specific licensing requirements for commercial use in larger organizations, which may not apply to every developer. The WSL2-based setup avoids this dependency.
Performance: Critically, running the DevContainer’s required Docker commands is significantly faster when the DevContainer and the Docker daemon are both running within the WSL2 filesystem. This avoids the performance penalty associated with mapping the Windows filesystem into Linux containers.
In short, your approach is valid and functional, but the recommended path (WSL2 with Docker daemon installed there) provides better long-term cost-effectiveness and performance for the build and deployment steps.
----Topic 2: Running cmf dev local stack up
Your intuition is correct:
Execute inside the DevContainer: Yes, all CM-specific commands, including cmf new, cmf build, cmf dev local stack up, cmf … should be executed inside the DevContainer terminal.
Why? The DevContainer is specifically configured to have all the necessary CM tooling, .NET SDKs, and environment variables pre-installed, ensuring a consistent and isolated build environment.
VS Code Tasks: To make this easier, your newly scaffolded project includes a .vscode/tasks.json file. You can use the VS Code Command Palette (Ctrl+Shift+P or Cmd+Shift+P) to run predefined tasks like “Stack Up” directly, which simplifies the process and avoids having to manually type the commands in the terminal.
Topic 3: Debugging Customizations
This is where the DevContainer significantly simplifies the backend debugging experience compared to previous workflow!
Backend Debugging (VS Code): You do not need to attach Visual Studio Pro to the host container anymore for C# debugging.
The CM DevContainer setup includes the necessary VS Code extensions to allow you to debug your C# business logic directly from VS Code. There are still manual steps, that may be enhanced in future, e.g. setup of launch.json.
You can set breakpoints in your C# files and use the standard VS Code Run and Debug interface (usually the side-bar icon) to attach to the running CMF service inside the container, offering a seamless experience. This is what the Development Workflow section of the CMF documentation refers to.
Visual Studio (Alternative): While the recommended approach is VS Code debugging, you can still use Visual Studio Pro if you prefer. However, this involves a few extra steps (as you noted) to configure remote debugging and port mapping, which Critical Manufacturing does not officially support or provide documentation for, as the primary workflow is now centered on the VS Code DevContainer environment. If you are able to understand current architecture, you should be able to setup the environment using Microsoft instructions to debug .NET containers using Microsoft Visual Studio.
Keep us posted on your progress.
Best regards,
João Moreira