Docker — Containerized Cross-Platform Deployment¶
Docker is used in the RflySim toolchain to implement containerized packaging and cross-architecture deployment for onboard algorithms, serving as a critical bridge from simulation environments to deployment on real onboard computers.
Why Docker?¶
In unmanned system development, algorithms are typically developed on x86 personal computers but ultimately need to be deployed on onboard computers with ARM architecture (such as Jetson Orin NX and RK3588). Docker solves the following problems:
| Problem | Docker's Solution |
|---|---|
| Dependency conflicts | The container encapsulates a complete runtime environment without affecting the host system |
| Cross-platform deployment | Generate ARM64 images using Docker Buildx |
| Environment consistency | The same container image is used across development → simulation → deployment |
| Rapid iteration | Only need to rebuild the image after modifying the algorithm, no reconfiguration of the environment required |
Environment Requirements¶
- WSL2 environment (Docker requires a complete Linux kernel)
- Docker Desktop for Windows, or Docker Engine installed inside WSL2
WSL2 is required
Docker does not support WSL1. If you are currently using WSL1, you need to switch to WSL2 first. For the switching method, please refer to WinWSL.
Cross-Architecture Image Generation¶
RflySim supports directly generating algorithm images for ARM64 architecture onboard computers on x86 personal computers:
graph LR
A[x86 Development Machine<br>Windows + WSL2] --> B[Docker Buildx<br>Multi-architecture Build]
B --> C[ARM64 Image]
C --> D[Push to Image Registry]
D --> E[Jetson Orin NX<br>ARM64 Onboard Computer]
E --> F[docker pull & run]
Build Example¶
# Execute in WSL2 environment
# Enable QEMU multi-architecture support
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# Create a cross-architecture builder
docker buildx create --name multiarch --driver docker-container --use
# Build and push ARM64 image
docker buildx build --platform linux/arm64 -t myregistry/my-uav-app:latest --push .
Typical Workflow¶
- Develop algorithms in WSL2: Use ROS + Python/C++ to complete perception/control algorithms
- Write a Dockerfile: Encapsulate the algorithm and all its dependencies
- Build the ARM64 image: Cross-architecture compilation using Docker Buildx
- Push the image: Upload to Docker Hub or a private image registry
- Pull and run on the onboard side: Run directly after
docker pullon platforms such as Jetson
Integration with RflySim Simulation¶
In the simulation phase, algorithms can also be containerized and run in Docker on WSL2, communicating with CopterSim / RflySim3D through the network to implement "containerized onboard system-in-the-loop simulation":
| Component | Running Location |
|---|---|
| CopterSim / RflySim3D | Windows Native |
| PX4 SITL | WSL2 or Docker |
| Perception/Decision Algorithms | WSL2 Docker Container |
Related Examples¶
| Example | Path |
|---|---|
| WSL2 + Docker Environment | RflySimAPIs\1.RflySimIntro\2.AdvExps\e13.WinWSL2-GPU |
| Docker Algorithm Deployment | RflySimAPIs\2.RflySimUsage\2.AdvExps\ |