Hyperledger fabricV1 on docker swarm

1k Views Asked by At

I have created a docker swarm with one manager and two workers and i am trying to deploy the hyperledger fabric on top of that for this i am using the below command

docker service create --name orderer.nokia.com hyperledger/fabric-orderer orderer\
--env ORDERER_GENERAL_LOGLEVEL=debug \
--env ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 \
--env ORDERER_GENERAL_GENESISMETHOD=file \
--env ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block \
--env ORDERER_GENERAL_LOCALMSPID=OrdererMSP \
--env ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp \
--env ORDERER_GENERAL_TLS_ENABLED=true \
--env ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key \
--env ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt \
--env ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] \
--mount type=bind,source=../channel-artifacts/genesis.block,destination=/var/hyperledger/orderer/orderer.genesis.block \
--mount type=bind,source=../crypto-config/ordererOrganizations/nokia.com/orderers/orderer.nokia.com/msp,destination=/var/hyperledger/orderer/msp \
--mount type=bind,source=../crypto-config/ordererOrganizations/nokia.com/orderers/orderer.nokia.com/tls/,destination=/var/hyperledger/orderer/tls \
--publish 7050:7050

but getting below error

Error response from daemon: rpc error: code = 3 desc = name must be valid as a DNS name component

docker node ls

ID                            HOSTNAME            STATUS              AVAILABILITY        MANAGER STATUS
o8ftuvxa3szzhgphxc71w5fv9 *   SwarmNode1-192      Ready               Active              Leader
sm7b4hf7oz9mkwksrxylu0ncq     SwarmNode3-194      Ready               Active
yag0gy3dlhu4fy8rl3iawro07     SwarmNode2-193      Ready               Active

OS:Ubuntu

Docker version 17.06.1-ce, build 874a737

1

There are 1 best solutions below

0
On

Had the same issue. In my case it was the names of the services having "." in them.

If you change it from --name orderer.nokia.com to --name orderernokiacom it should build correctly.

However, I am still trying to deploy chaincode successfully so not 100% sure

========================================EDIT===============================

I have it set up and running with no problems now. Indeed the error you are getting is from the "dots" in the services names.

If for some reason you need your service names to contain "." you can use network aliases.

To deploy in swarm mode, you first need to create an overlay network (if you are using compose this has to be created outside the compose file).

And then everything should work just fine. For an example have a look https://github.com/endimion/HL_V1_test/blob/master/docker-swarm-compose.yml