You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Hyperledger Composer REST API操作报错:连接127.0.0.1:7054被拒求助

Troubleshooting: ECONNREFUSED 127.0.0.1:7054 in Hyperledger Composer REST Server

Let’s break down this error step by step—you’re hitting a classic connectivity issue between your REST server and the Hyperledger Fabric Certificate Authority (CA). The connect ECONNREFUSED message means your REST server can’t reach the CA service running on port 7054, and here are the most likely causes:

1. The Fabric CA service isn’t running (or isn’t on port 7054)

The default Fabric CA port is 7054, but if the CA container failed to start, or you modified its port during setup, the REST server won’t find it.

  • Run docker ps to check if your CA container is listed with an Up status. Look for a line like ca.org1.example.com with port mapping 0.0.0.0:7054->7054/tcp.
  • If the CA isn’t running, start it with docker start <ca-container-name>. If it’s on a different port, update your REST server’s CA URL configuration to match.

2. You’re using 127.0.0.1 instead of the CA container’s name (Docker network quirk)

When running in Docker, each container has its own localhost—so your REST server container can’t reach the CA container via 127.0.0.1. You need to use the CA container’s name (or its service name if using Docker Compose) for inter-container communication.

  • For example, if your CA container is named ca.org1.example.com, your REST server should be configured to use http://ca.org1.example.com:7054 as the CA URL, not http://127.0.0.1:7054.
  • Double-check the environment variables you used to start the REST server—look for COMPOSER_CA_URL and ensure it uses the CA container’s name.

3. The REST server and CA containers aren’t on the same Docker network

Docker isolates containers into separate networks by default. If your REST server is on a different network than the CA, they can’t talk to each other.

  • Run docker network inspect <your-fabric-network-name> (common names are composer_default or fabric_test) to list all containers in the network. Both the CA and REST server should be listed here.
  • If the REST server is missing, add it to the network with docker network connect <network-name> <rest-server-container-name>.

4. TLS configuration mismatches (if you enabled TLS for the CA)

If you set up the CA with TLS enabled but didn’t configure the REST server to use the CA’s TLS certificate, the connection will be rejected.

  • Verify if your CA is using TLS by checking its startup logs with docker logs <ca-container-name>. Look for references to TLS certificates.
  • If TLS is enabled, pass the CA’s certificate to the REST server using the COMPOSER_CA_CERTIFICATE environment variable when starting it.

Quick Debugging Steps

  1. Test CA reachability from the REST server container:

    docker exec -it <rest-server-container-name> curl http://<ca-container-name>:7054/cainfo
    

    If this returns a JSON response, the network is working—your issue is likely in the REST server’s configuration. If it fails, focus on network connectivity or CA status.

  2. Check CA logs for startup errors:

    docker logs <ca-container-name>
    

    Look for lines indicating failed certificate loading or port binding issues.

内容的提问来源于stack exchange,提问作者Simon Mullaney

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:09:22