An error is reported when instantiating the chaincode in the cli container
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: Failed to generate platform-specific docker build: Error executing build: API error (404): network _basic not found ""
Notice the last line network _basic not found, indicating that the corresponding network is not matched, and the peer network and docke network are not together.
Open my docker-compose.yml file
In the column of the red frame, I did not define COMPOSE_PROJECT_NAME when configuring the environment variable, causing the system to default to an empty string, which can be explained from the printed log
Because when instantiating manually, the default configuration file is used directly, and the default node network configuration is in the form of ${xx}_basic, which will be empty
Solution:
Simply change the configuration directly, change COMPOSE_PROJECT_NAME to our Networkname
Exit the cli container, docker ps first check our container id
then type
docker inspect (刚才查看的容器ID)
Find the item NetworkMode and know that the network name of our docker is basic-network_basic
Change our configuration in docker-compose.yml file
Be sure to save the modified file
Let's go through the initialization process again
Then docker ps to view the container id
Shut down the running docker container
docker container stop CONTAINER ID
Clean up docker containers and network:
docker rm $(docker ps -qa)
docker network prune
You can see that Networkname is basic-network_basic
start network
You can see that the last warning is no longer reported in the red box, and the startup is successful!
Enter the cli container
Install chaincode
The next step is to instantiate the chaincode