Composer 0.19.0:Playground网络更新:非Deploy changes方式及仅更新容器内网络
Hey there, let's break down your two questions about Hyperledger Composer Playground and container management step by step!
In the Composer Playground UI, the "Deploy changes" button is the go-to built-in option for pushing updates after modifying your network files directly in the editor. But if you're looking for an alternative within Playground itself, here's what you can do:
- Export and re-import your updated network:
- If you made changes right in Playground's Define tab, click the "Export" button to download a BNA file of your modified network.
- Head back to the "My Business Networks" page.
- Locate your existing network, click the three-dot menu next to it, and select "Update".
- Upload the BNA file you just exported (or a locally packaged BNA if you made changes outside Playground) and follow the prompts to complete the update.
This approach skips the "Deploy changes" button but achieves the same result of updating your network.
The behavior you're seeing—new Docker images and containers being created every time you click "Deploy changes"—is a known quirk in Composer 0.19.0. The Playground's deploy flow in this version doesn't perform a chaincode upgrade; instead, it deploys an entirely new instance of your business network as a separate chaincode. Each new deployment spins up a fresh container, and old ones aren't automatically cleaned up, leading to the backlog you're dealing with.
Here are two solutions to fix this:
Option 1: Use the command line to upgrade your network (recommended)
This method updates the existing chaincode instance without spinning up new containers:
- Package your updated network: Navigate to your network project directory in the terminal and run:
This generates a BNA file (e.g.,composer archive create -t dir -n .my-network@0.0.1.bna) containing your modified files. - Upgrade the deployed network: Run the upgrade command, replacing the placeholders with your specific details:
This will update the chaincode running in your existing container, no new containers will be created.composer network upgrade -c admin@<your-network-name> -a <path-to-your-updated.bna>
Option 2: Clean up old containers manually
If you already have a pile of unused Composer containers cluttering your Docker environment, you can prune them with these commands:
- Stop all Composer-related containers:
docker stop $(docker ps -a | grep composer | awk '{print $1}') - Delete the stopped containers:
docker rm $(docker ps -a | grep composer | awk '{print $1}') - To free up additional space, you can also remove unused Composer images:
Note: Be cautious with these commands—they will remove all Composer-related containers and images, so ensure you don't need any of them before executing.docker rmi $(docker images | grep composer | awk '{print $3}')
内容的提问来源于stack exchange,提问作者T_murder

