Hyperledger Fabric启动报错:无法创建peer0.org1.example.com容器
startFabric.sh on Windows 10 Pro Hey there, I’ve run into this exact headache when setting up Hyperledger Fabric on Windows 10 Pro—let’s break down how to fix it. The error pops up because Docker on Windows struggles with the Linux-style path /var/run being mounted in the Fabric peer container, especially if you’re using the wrong terminal environment or haven’t tweaked Docker’s settings properly.
Here are the step-by-step fixes to try:
1. Run the script in a WSL 2 terminal (not PowerShell/CMD)
Hyperledger Fabric’s shell scripts are built for Linux environments. Running them directly in Windows’ native terminals (PowerShell/CMD) messes up path translation.
- Open your preferred WSL 2 distribution (like Ubuntu) from the Start Menu
- Navigate to your Fabric project directory within the WSL filesystem (e.g.,
cd ~/fabric-samples/composer) - Re-run
./startFabric.shfrom here—this lets Linux-style paths work as intended.
2. Check Docker Desktop’s WSL Integration settings
Docker needs proper integration with your WSL 2 distro to handle mounts correctly:
- Open Docker Desktop, go to Settings > Resources > WSL Integration
- Make sure the toggle for your WSL 2 distro (e.g., Ubuntu) is switched on
- Click Apply & Restart to save changes
3. Manually adjust the mount path in startFabric.sh (if needed)
If the above steps don’t resolve the issue, tweak the problematic mount line in the script:
- Open
startFabric.shin a text editor (usenano startFabric.shwithin WSL) - Find the section defining
peer0.org1.example.com—you’ll see a line like:-v /var/run:/host/var/run/ \ - Replace it with the WSL-compatible path:
-v /run:/host/var/run/ \ - Save the file and re-run the script.
4. Reset Docker’s File Sharing permissions
Sometimes Docker’s file sharing settings block valid mounts:
- In Docker Desktop, go to Settings > Resources > File Sharing
- Ensure the drive where your Fabric project is stored (usually C:) is checked
- Click Apply & Restart to refresh permissions
After trying these steps, re-run ./startFabric.sh—the mount error should be gone, and your Fabric network should start up smoothly.
内容的提问来源于stack exchange,提问作者Nathalie

