docker containers connection refused

1,559 views
Skip to first unread message

Fabrizio Marangio

unread,
May 17, 2022, 3:06:44 AM5/17/22
to grpc.io
Hi all, I am setting up an Hyperledger Fabric network using docker-compose. I have some containers and some of them (orderers) need talk each others to elect a raft leader. When i see at the grpc logs i have this type of error:

[core]pickfirstBalancer: UpdateSubConnState: 0xc000496280, {TRANSIENT_FAILURE connection error: desc = "transport: Error while dialing dial tcp 172.18.0.3:8050: connect: connection refused"}

I tried to add the host names indicated in the compose file to the hosts file (i'm using ubuntu 20.04)  but without success.

Can you help me with this issue?

This is my docker-compose yaml:

version: '2'

networks:
  fabric-ca:

services:
  tls-ca:
    container_name: tls-ca
    image: hyperledger/fabric-ca:1.5.2
    command: sh -c 'fabric-ca-server start -d -b tls-ca-admin:tls-ca-adminpw --port 7052'
    environment:
        - FABRIC_CA_SERVER_HOME=/tmp/hyperledger/fabric-ca/crypto
        - FABRIC_CA_SERVER_TLS_ENABLED=true
        - FABRIC_CA_SERVER_CA_NAME=tls-ca
        - FABRIC_CA_SERVER_CSR_HOSTS=tls-ca
        - FABRIC_CA_SERVER_CSR_CN=tls-ca
        - FABRIC_CA_SERVER_DEBUG=true
    volumes:
        - /tmp/hyperledger/tls-ca:/tmp/hyperledger/fabric-ca
        - /tmp/hyperledger/assets:/assets
    networks:
        - fabric-ca
    ports:
        - 7052:7052

  ordererCA1:
    container_name: ordererCA1
    image: hyperledger/fabric-ca:1.5.2
    command: sh -c 'fabric-ca-server start -d -b ordererCA1-admin:ordererCA1-adminpw --port 7053'
    environment:
        - FABRIC_CA_SERVER_HOME=/tmp/hyperledger/fabric-ca/crypto
        - FABRIC_CA_SERVER_TLS_ENABLED=true
        - FABRIC_CA_SERVER_CSR_CN=ordererCA1
        - FABRIC_CA_SERVER_CSR_HOSTS=ordererCA1
        - FABRIC_CA_SERVER_DEBUG=true
    volumes:
        - /tmp/hyperledger/ordCA1/ca:/tmp/hyperledger/fabric-ca
        - /tmp/hyperledger/assets:/assets
        - /tmp/hyperledger/ordCA1/:/tmp/hyperledger/fabric-ca-enrollment
    networks:
        - fabric-ca
    ports:
        - 7053:7053

  ordererCA2:
    container_name: ordererCA2
    image: hyperledger/fabric-ca:1.5.2
    command: sh -c 'fabric-ca-server start -d -b ordererCA2-admin:ordererCA2-adminpw --port 8053'
    environment:
        - FABRIC_CA_SERVER_HOME=/tmp/hyperledger/fabric-ca/crypto
        - FABRIC_CA_SERVER_TLS_ENABLED=true
        - FABRIC_CA_SERVER_CSR_CN=ordererCA2
        - FABRIC_CA_SERVER_CSR_HOSTS=ordererCA2
        - FABRIC_CA_SERVER_DEBUG=true
    volumes:
        - /tmp/hyperledger/ordCA2/ca:/tmp/hyperledger/fabric-ca
        - /tmp/hyperledger/assets:/assets
        - /tmp/hyperledger/ordCA2/:/tmp/hyperledger/fabric-ca-enrollment
    networks:
        - fabric-ca
    ports:
        - 8053:8053

  ordererCA3:
    container_name: ordererCA3
    image: hyperledger/fabric-ca:1.5.2
    command: sh -c 'fabric-ca-server start -d -b ordererCA3-admin:ordererCA3-adminpw --port 9053'
    environment:
        - FABRIC_CA_SERVER_HOME=/tmp/hyperledger/fabric-ca/crypto
        - FABRIC_CA_SERVER_TLS_ENABLED=true
        - FABRIC_CA_SERVER_CSR_CN=ordererCA3
        - FABRIC_CA_SERVER_CSR_HOSTS=ordererCA3
        - FABRIC_CA_SERVER_DEBUG=true
    volumes:
        - /tmp/hyperledger/ordCA3/ca:/tmp/hyperledger/fabric-ca
        - /tmp/hyperledger/assets:/assets
        - /tmp/hyperledger/ordCA3/:/tmp/hyperledger/fabric-ca-enrollment
    networks:
        - fabric-ca
    ports:
        - 9053:9053

  rca-org1:
    container_name: rca-org1
    image: hyperledger/fabric-ca:1.5.2
    command: sh -c 'fabric-ca-server start -d -b rca-org1-admin:rca-org1-adminpw --port 7054'
    environment:
        - FABRIC_CA_SERVER_HOME=/tmp/hyperledger/fabric-ca/crypto
        - FABRIC_CA_SERVER_TLS_ENABLED=true
        - FABRIC_CA_SERVER_CSR_CN=rca-org1
        - FABRIC_CA_SERVER_CSR_HOSTS=rca-org1
        - FABRIC_CA_SERVER_DEBUG=true
    volumes:
        - /tmp/hyperledger/org1/ca:/tmp/hyperledger/fabric-ca
        - /tmp/hyperledger/assets:/assets
        - /tmp/hyperledger/org1/:/tmp/hyperledger/fabric-ca-enrollment
    networks:
        - fabric-ca
    ports:
        - 7054:7054

  rca-org2:
    container_name: rca-org2
    image: hyperledger/fabric-ca:1.5.2
    command: sh -c 'fabric-ca-server start -d -b rca-org2-admin:rca-org2-adminpw --port 7055'
    environment:
        - FABRIC_CA_SERVER_HOME=/tmp/hyperledger/fabric-ca/crypto
        - FABRIC_CA_SERVER_TLS_ENABLED=true
        - FABRIC_CA_SERVER_CSR_CN=rca-org2
        - FABRIC_CA_SERVER_CSR_HOSTS=rca-org2
        - FABRIC_CA_SERVER_DEBUG=true
    volumes:
        - /tmp/hyperledger/org2/ca:/tmp/hyperledger/fabric-ca
        - /tmp/hyperledger/assets:/assets
        - /tmp/hyperledger/org2/:/tmp/hyperledger/fabric-ca-enrollment
    networks:
        - fabric-ca
    ports:
        - 7055:7055

  peer1-org1:
    container_name: peer1-org1
    image: hyperledger/fabric-peer:2.4
    environment:
        - CORE_PEER_ID=peer1-org1
        - CORE_PEER_ADDRESS=peer1-org1:7051
        - CORE_PEER_LOCALMSPID=org1MSP
        - CORE_PEER_LISTENADDRESS=0.0.0.0:7051
        - CORE_PEER_MSPCONFIGPATH=/tmp/hyperledger/org1/peer1/msp
        - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
        - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=tam-docker-multiOrderer_fabric-ca
        - FABRIC_LOGGING_SPEC=info
        - CORE_PEER_TLS_ENABLED=true
        - CORE_PEER_TLS_CERT_FILE=/tmp/hyperledger/org1/peer1/tls-msp/signcerts/cert.pem
        - CORE_PEER_TLS_KEY_FILE=/tmp/hyperledger/org1/peer1/tls-msp/keystore/key.pem
        - CORE_PEER_TLS_ROOTCERT_FILE=/tmp/hyperledger/org1/peer1/tls-msp/tlscacerts/tls-tls-ca-7052.pem
        - CORE_PEER_GOSSIP_USELEADERELECTION=true
        - CORE_PEER_GOSSIP_ORGLEADER=false
        - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1-org1:7051
        - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/org1/peer1
    volumes:
        - /var/run:/host/var/run
        - /tmp/hyperledger/org1/peer1:/tmp/hyperledger/org1/peer1
        - /tmp/hyperledger/assets:/assets        
    ports:
        - 7051:7051
    networks:
        - fabric-ca

  peer1-org2:
    container_name: peer1-org2
    image: hyperledger/fabric-peer:2.4
    environment:
        - CORE_PEER_ID=peer1-org2
        - CORE_PEER_ADDRESS=peer1-org2:9051
        - CORE_PEER_LOCALMSPID=org2MSP
        - CORE_PEER_LISTENADDRESS=0.0.0.0:9051
        - CORE_PEER_MSPCONFIGPATH=/tmp/hyperledger/org2/peer1/msp
        - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
        - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=tam-docker-multiOrderer_fabric-ca
        - FABRIC_LOGGING_SPEC=info
        - CORE_PEER_TLS_ENABLED=true
        - CORE_PEER_TLS_CERT_FILE=/tmp/hyperledger/org2/peer1/tls-msp/signcerts/cert.pem
        - CORE_PEER_TLS_KEY_FILE=/tmp/hyperledger/org2/peer1/tls-msp/keystore/key.pem
        - CORE_PEER_TLS_ROOTCERT_FILE=/tmp/hyperledger/org2/peer1/tls-msp/tlscacerts/tls-tls-ca-7052.pem
        - CORE_PEER_GOSSIP_USELEADERELECTION=true
        - CORE_PEER_GOSSIP_ORGLEADER=false
        - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1-org2:9051
        - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/org2/peer1
    volumes:
        - /var/run:/host/var/run
        - /tmp/hyperledger/org2/peer1:/tmp/hyperledger/org2/peer1
        - /tmp/hyperledger/assets:/assets        
    ports:
        - 9051:9051
    networks:
        - fabric-ca

  orderer1:
    container_name: orderer1
    image: hyperledger/fabric-orderer:2.4
    environment:
        - ORDERER_HOME=/tmp/hyperledger/orderer
        - ORDERER_HOST=orderer1
        - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
        - ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:8443
        - ORDERER_GENERAL_LISTENPORT=7050
        - ORDERER_GENERAL_BOOTSTRAPMETHOD=file
        - ORDERER_GENERAL_BOOTSTRAPFILE=/tmp/hyperledger/ordCA1/orderer/genesis.block
        - ORDERER_GENERAL_LOCALMSPID=ordCA1MSP
        - ORDERER_GENERAL_LOCALMSPDIR=/tmp/hyperledger/ordCA1/orderer/msp
        - ORDERER_GENERAL_TLS_ENABLED=true
        - ORDERER_GENERAL_TLS_CERTIFICATE=/tmp/hyperledger/ordCA1/orderer/tls-msp/signcerts/cert.pem
        - ORDERER_GENERAL_TLS_PRIVATEKEY=/tmp/hyperledger/ordCA1/orderer/tls-msp/keystore/key.pem
        - ORDERER_GENERAL_TLS_ROOTCAS=[/tmp/hyperledger/ordCA1/orderer/tls-msp/tlscacerts/tls-tls-ca-7052.pem]
        - ORDERER_GENERAL_LOGLEVEL=debug
        - ORDERER_DEBUG_BROADCASTTRACEDIR=data/logs
        - FABRIC_LOGGING_SPEC=grpc=debug:info
    volumes:
        - /tmp/hyperledger/ordCA1/orderer:/tmp/hyperledger/ordCA1/orderer/
    ports:
        - 7050:7050
        - 8443:8443
    networks:
        - fabric-ca

  orderer2:
    container_name: orderer2
    image: hyperledger/fabric-orderer:2.4
    environment:
        - ORDERER_HOME=/tmp/hyperledger/orderer
        - ORDERER_HOST=orderer2
        - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
        - ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:8443
        - ORDERER_GENERAL_LISTENPORT=8050
        - ORDERER_GENERAL_BOOTSTRAPMETHOD=file
        - ORDERER_GENERAL_BOOTSTRAPFILE=/tmp/hyperledger/ordCA2/orderer/genesis.block
        - ORDERER_GENERAL_LOCALMSPID=ordCA2MSP
        - ORDERER_GENERAL_LOCALMSPDIR=/tmp/hyperledger/ordCA2/orderer/msp
        - ORDERER_GENERAL_TLS_ENABLED=true
        - ORDERER_GENERAL_TLS_CERTIFICATE=/tmp/hyperledger/ordCA2/orderer/tls-msp/signcerts/cert.pem
        - ORDERER_GENERAL_TLS_PRIVATEKEY=/tmp/hyperledger/ordCA2/orderer/tls-msp/keystore/key.pem
        - ORDERER_GENERAL_TLS_ROOTCAS=[/tmp/hyperledger/ordCA2/orderer/tls-msp/tlscacerts/tls-tls-ca-7052.pem]
        - ORDERER_GENERAL_LOGLEVEL=debug
        - ORDERER_DEBUG_BROADCASTTRACEDIR=data/logs
        - FABRIC_LOGGING_SPEC=grpc=debug:info
    volumes:
        - /tmp/hyperledger/ordCA2/orderer:/tmp/hyperledger/ordCA2/orderer/
    ports:
        - 8050:8050
        - 8444:8443
    networks:
        - fabric-ca

  orderer3:
    container_name: orderer3
    image: hyperledger/fabric-orderer:2.4
    environment:
        - ORDERER_HOME=/tmp/hyperledger/orderer
        - ORDERER_HOST=orderer3
        - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
        - ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:8443
        - ORDERER_GENERAL_LISTENPORT=9050
        - ORDERER_GENERAL_BOOTSTRAPMETHOD=file
        - ORDERER_GENERAL_BOOTSTRAPFILE=/tmp/hyperledger/ordCA3/orderer/genesis.block
        - ORDERER_GENERAL_LOCALMSPID=ordCA3MSP
        - ORDERER_GENERAL_LOCALMSPDIR=/tmp/hyperledger/ordCA3/orderer/msp
        - ORDERER_GENERAL_TLS_ENABLED=true
        - ORDERER_GENERAL_TLS_CERTIFICATE=/tmp/hyperledger/ordCA3/orderer/tls-msp/signcerts/cert.pem
        - ORDERER_GENERAL_TLS_PRIVATEKEY=/tmp/hyperledger/ordCA3/orderer/tls-msp/keystore/key.pem
        - ORDERER_GENERAL_TLS_ROOTCAS=[/tmp/hyperledger/ordCA3/orderer/tls-msp/tlscacerts/tls-tls-ca-7052.pem]
        - ORDERER_GENERAL_LOGLEVEL=debug
        - ORDERER_DEBUG_BROADCASTTRACEDIR=data/logs
        - FABRIC_LOGGING_SPEC=grpc=debug:info
    volumes:
        - /tmp/hyperledger/ordCA3/orderer:/tmp/hyperledger/ordCA3/orderer/
    ports:
        - 9050:9050
        - 8445:8443
    networks:
        - fabric-ca

dfa...@google.com

unread,
May 20, 2022, 2:04:42 PM5/20/22
to grpc.io
This sounds like it might be a more generic networking (docker config) problem than a gRPC issue.  Are your containers able to reach each other using other operations (e.g. ping)?

Fabrizio Marangio

unread,
May 21, 2022, 5:41:22 AM5/21/22
to dfa...@google.com, grpc.io
Yes, it was a configuration problem. I solved it.
However, thanks for your reply.

--
You received this message because you are subscribed to a topic in the Google Groups "grpc.io" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/grpc-io/7edXgJxY3uQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/9e413eea-0838-467b-96a8-e8909067f024n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages