Thank you for providing the device information! You’re running Torizon OS 7.5.0 on a Colibri iMX7D. Now I can provide specific guidance for your multi-container .NET project setup.
Project Reference Solutions for Multi-Container Workspaces
For your WebAssembly projects sharing API models between the GUI frontend and CAN interface containers, here are the recommended approaches:
1. Shared Library with File Mounting
The most effective solution is to create a shared library and use file mounting between your workspace and containers. In multi-container projects, the SDK container mounts the project’s workspace into the container, so no additional configuration is required for the build process(1).
For your debug containers, you’ll need to add files to containers using the COPY command in Dockerfile.debug(1):
COPY --chown=$SSHUSERNAME:$SSHUSERNAME ./shared-models ${APP_ROOT}/shared-models
(1)
2. Adding Files Shared Between Projects
Since you have multiple projects that need to share code, you can create a shared library outside your individual project workspaces. The documentation specifically addresses this scenario(1).
Create a synchronization task in your tasks.json file using rsync(1):
{
"label": "rsync-shared-models",
"detail": "",
"hide": true,
"command": "rsync",
"type": "process",
"args": [
"-av",
"../shared-api-models",
"./shared-models"
],
"dependsOrder": "sequence",
"problemMatcher": "$msCompile"
}
(1)
3. Multi-Container Docker Compose Configuration
Your multi-container project uses docker-compose.yml to orchestrate execution of all single-container applications together(2). You can modify this file to include volume mounts for shared source code:
services:
hmifrontend:
build:
context: .
dockerfile: hmifrontend/Dockerfile
volumes:
- ./shared-models:/app/shared-models
depends_on:
- caninterface
caninterface:
build:
context: .
dockerfile: caninterface/Dockerfile
volumes:
- ./shared-models:/app/shared-models
(2)
4. Container Communication
For inter-container communication, Docker Compose sets up a single network for your app by default. Each container is discoverable by other containers at a hostname identical to the container name(3). This explains why your HTTP communication between containers is working successfully.
5. NuGet Package Management
For .NET packages in your projects, you can use the standard approach. To add .NET packages, run the following command in VS Code’s terminal(1):
dotnet add package <PackageName>
(1)
Recommended Implementation Steps
- Create a
shared-models directory in your workspace root
- Move your common API models to this shared directory
- Add the rsync task to synchronize the shared models to each project
- Update your
Dockerfile.debug files to copy the shared models
- Modify your project references to use the local shared models path
This approach avoids code duplication while maintaining the containerized architecture that Torizon multi-container projects require.
Best regards, Toradex AI Assistant.
Did you like my answer?

If I answered your question, please tick the “Solution” checkbox.
For follow-up questions to me, please use @ToradexAI in your post.