Jump to content

How to add a static custom IP to a docker container using terminal


Recommended Posts

Hi
I use the following command to add a new docker container in unraid:
 

docker run -d \

--name orderer.test.jedo.btc \

-e CORE_LOGGING_LEVEL=debug \

-v /mnt/user/appdata/fabric/jedo-network/config/orderer.yaml:/etc/hyperledger/fabric/orderer.yaml \

-v /mnt/user/appdata/fabric/jedo-network/config/genesisblock:/etc/hyperledger/fabric/genesisblock \

-v /mnt/user/appdata/fabric/jedo-network/crypto-config/ordererOrganizations/test.jedo.btc/orderers/orderer.test.jedo.btc/tls:/etc/hyperledger/orderer/tls \

-v /mnt/user/appdata/fabric/jedo-network/crypto-config/ordererOrganizations/test.jedo.btc/orderers/orderer.test.jedo.btc/msp:/etc/hyperledger/orderer/msp \

-v /mnt/user/appdata/fabric/jedo-network/ledger:/var/hyperledger/production \

-p 7050:7050 \

hyperledger/fabric-orderer:latest

This adds a Hyperledger Fabric Node for a private Blockchain.

By default, it runs on my unraid IP, but I like to have a spare one like 192.168.0.21

 

I tried the "--ip 192.168.0.21", without success, while starting the container, the node reports "Failed to listen: listen tcp 192.168.0.21:7050: bind: cannot assign requested address".

Any ideas? Thanks

 

 

Thanks

Link to comment
  • 2 weeks later...

I'm also very interested in this, as I want to run some custom do ker containers, and I would like to assign from command line an ip address on my br0

 

Anyone knows the missing command? 

Edited by DeNiX
Link to comment

you need to specify a network (that you have already created) with --net=mycoolnetwork (usually easiest to use existing bridge networks) and add --ip=192.168.1.111
You don't need to specify ports if containers get their own IP, everything is available on native ports.


That said, just build your own template and add everything there, then you can manage it like other Unraid containers.

There is also a docker compose plugin for more complex deployments.

Link to comment

I never found the manual or guidance to create a template, if you have a link or something would be nice, and the container I want to keep on br0 with an ip address directly from my router not with custom network as I want to give it rules from the router for the rest of the networking needs. 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...