Something wrong on deploy chaincode for hyperledger v1.0

后端 未结 2 1921
梦如初夏
梦如初夏 2021-01-26 16:10

I have tried to use docker toolbox to setup Hyperledger V1.0 in my local machines. I according to this document: http://hyperledger-fabric.readthedocs.io/en/latest/asset_setup.

相关标签:
2条回答
  • 2021-01-26 16:49

    I was having the same issue while following the latest "Writing Your First Application" tutorial (http://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html). I had installed all the pre-requisites and the fabric-samples and started the local network.

    When I got to the step of enrolling the Admin user, $ node enrollAdmin.js, I was getting the same error message as above, Error: connect ECONNREFUSED, followed by the localhost domain.

    As the first answer suggests, the root cause is that I'm running Docker Toolbox. I'm developing on an older Mac, OSX v10.9.5, so I couldn't use Docker for Mac.

    To fix the issue, I replaced 'localhost' in the enrollAdmin.js code with the IP from Docker Toolbox.

    Here are the steps I took:

    1. Started Docker with Applications > Docker Quickstart Terminal
    2. Copied the IP from this sentence: docker is configured to use the default machine with IP...
    3. Opened the copy of enrollAdmin.js from fabric-samples/fabcar directory
    4. Found this code:

      // be sure to change the http to https when the CA is running TLS enabled
      fabric_ca_client = new Fabric_CA_Client('http://localhost:7054', tlsOptions , 'ca.example.com', crypto_suite); // <-- This is the line to change
      
    5. Replaced 'localhost' with the Docker IP, leaving the port :7054 as is.
    6. Saved
    7. Re-ran the command, $ node enrollAdmin.js

    The script connected to the CA and successfully completed the Admin enrollment.

    On to the next step!

    0 讨论(0)
  • 2021-01-26 16:56

    There were several problems, not the least of which that documentation was outdated and was for a preview release of Hyperledger Fabric. The docs are actually in the process of being removed as we need to update our examples / samples.

    You mentioned Docker Toolbox - so are you trying to run all of this on Windows or Mac?

    UPDATE:

    So one of the issue with Docker Toolbox or Docker for Windows is that you cannot use localhost / 127.0.0.1 as the address when trying to communicate from apps on the host (even in the QuickStart Terminal) to the endpoints of the Docker containers. When the QuickStart Terminal first launches Docker, you'll see that it will output the IP address of the endpoint you should use when communicating with exposed ports.

    0 讨论(0)
提交回复
热议问题