Run a node per docker container

+4 votes
Is it possible to run a node per container and make them discover each other? Currently, I have made a Dockerfile:
```

FROM ubuntu:16.04

WORKDIR /

ADD . /multichain

RUN apt-get update
RUN apt-get -y install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils
RUN apt-get -y install libboost-all-dev
RUN apt-get -y install git
RUN apt-get -y install software-properties-common
RUN add-apt-repository ppa:bitcoin/bitcoin
RUN apt-get update
RUN apt-get -y install libdb4.8-dev libdb4.8++-dev

WORKDIR /multichain

RUN ./autogen.sh
RUN ./configure
RUN make

RUN cp src/multichain-util /usr/local/bin/
RUN cp src/multichaind /usr/local/bin/
RUN cp src/multichain-cli /usr/local/bin/

```
But since the `IP` and `port` of the chain are created randomly upon chain initialization, I cannot know what port and IP to expose when I run the containers.
asked Mar 2, 2018 by milkncookiez

1 Answer

+2 votes
 
Best answer

There's no need for the ports to be random – you can add parameters to multichain-util on the command line to fix the value of any blockchain parameter, including default-network-port and default-rpc-port.

As for the IP address I can't comment since this is a Docker issue – MultiChain will list on all IP addresses that are available to it in the host environment.

answered Mar 2, 2018 by MultiChain
selected Apr 13, 2018 by milkncookiez
I do run `multichain-util create chain1 -port=6060` but the port is still randomly generated. Tried different variations of the `port` param, like `--port` or just `port`, but no effect.
You need to use the actual blockchain parameter name, e.g.:

-default-network-port=6060
...