Closed joesixpack closed 4 years ago
Perhaps you did not stop the container when building the new version and/or copying new files again. This is done by the following command - docker-compose down -v
.
Unfortunately, I was not able to repeat your case.
Could you attach the entire output log (console) from the very beginning of your actions?
Well, looks like I was wrong. The same issue occurs with the multiple container configuration, except the containers are stopped instead of continously restarting as with running a single container. I always stop and remove containers before doing a docker-compose up. docker-compose down did not make a difference. I think this issue is related to the docker-compose being run from a script because it does not happen when typing in the command manually.
j@optiplex980-1:~ cat elrond.sh
git clone https://github.com/mrz1703/elrond-node.git cd elrond-node cp docker-compose.multiple.yml docker-compose.yml docker-compose build
docker-compose run -w /opt/app/config elrond-1 sh -c "cp /tmp/config/ /opt/app/config/" docker-compose run -w /opt/app/config elrond-2 sh -c "cp /tmp/config/ /opt/app/config/" docker-compose up -d elrond-1 docker-compose up -d elrond-2
j@optiplex980-1:~ ./elrond.sh fatal: destination path 'elrond-node' already exists and is not an empty directory. Building elrond-1 Step 1/15 : FROM golang:1.13-alpine as build ---> 33fbbc2ca571 Step 2/15 : RUN apk update && apk upgrade && apk add --no-cache curl bash mc git make gcc g++ linux-headers libgcc libstdc++ ---> Using cache ---> 79a4dc3e02b5 Step 3/15 : WORKDIR /opt ---> Using cache ---> 0b031c56f98e Step 4/15 : ARG ELROND_VERSION ---> Using cache ---> 81031d78a5b9 Step 5/15 : RUN git clone -b ${ELROND_VERSION} https://github.com/ElrondNetwork/elrond-go ---> Using cache ---> 3b30b3f0a98a Step 6/15 : RUN cd ./elrond-go && GO111MODULE=on go mod vendor && cd cmd/keygenerator && go build && cd ../node && go build -i -v -ldflags="-X main.appVersion=$(git describe --tags --long --dirty)" ---> Using cache ---> 0bf8497fab6f Step 7/15 : ARG CONFIG_VERSION ---> Using cache ---> f0618e422df3 Step 8/15 : WORKDIR /opt ---> Using cache ---> cb4a85f3a108 Step 9/15 : RUN git clone -b ${CONFIG_VERSION} https://github.com/ElrondNetwork/elrond-config ---> Using cache ---> 39f4b1b7fe57 Step 10/15 : FROM alpine ---> 961769676411 Step 11/15 : WORKDIR /opt/app ---> Using cache ---> 0ec605546716 Step 12/15 : COPY --from=build /opt/elrond-config/ /tmp/config/ ---> Using cache ---> bdd2197f1777 Step 13/15 : COPY --from=build /opt/elrond-go/cmd/keygenerator/keygenerator /opt/elrond-go/cmd/node/node /opt/app/ ---> Using cache ---> 29c48e03a9f0 Step 14/15 : RUN ln -s /opt/app/node /usr/local/bin/ && ln -s /opt/app/keygenerator /usr/local/bin/ ---> Using cache ---> 977935286b28 Step 15/15 : CMD node --use-log-view ---> Using cache ---> 59409960d95e Successfully built 59409960d95e Successfully tagged elrond-node_elrond-1:latest Building elrond-2 Step 1/15 : FROM golang:1.13-alpine as build ---> 33fbbc2ca571 Step 2/15 : RUN apk update && apk upgrade && apk add --no-cache curl bash mc git make gcc g++ linux-headers libgcc libstdc++ ---> Using cache ---> 79a4dc3e02b5 Step 3/15 : WORKDIR /opt ---> Using cache ---> 0b031c56f98e Step 4/15 : ARG ELROND_VERSION ---> Using cache ---> 81031d78a5b9 Step 5/15 : RUN git clone -b ${ELROND_VERSION} https://github.com/ElrondNetwork/elrond-go ---> Using cache ---> 3b30b3f0a98a Step 6/15 : RUN cd ./elrond-go && GO111MODULE=on go mod vendor && cd cmd/keygenerator && go build && cd ../node && go build -i -v -ldflags="-X main.appVersion=$(git describe --tags --long --dirty)" ---> Using cache ---> 0bf8497fab6f Step 7/15 : ARG CONFIG_VERSION ---> Using cache ---> f0618e422df3 Step 8/15 : WORKDIR /opt ---> Using cache ---> cb4a85f3a108 Step 9/15 : RUN git clone -b ${CONFIG_VERSION} https://github.com/ElrondNetwork/elrond-config ---> Using cache ---> 39f4b1b7fe57 Step 10/15 : FROM alpine ---> 961769676411 Step 11/15 : WORKDIR /opt/app ---> Using cache ---> 0ec605546716 Step 12/15 : COPY --from=build /opt/elrond-config/ /tmp/config/ ---> Using cache ---> bdd2197f1777 Step 13/15 : COPY --from=build /opt/elrond-go/cmd/keygenerator/keygenerator /opt/elrond-go/cmd/node/node /opt/app/ ---> Using cache ---> 29c48e03a9f0 Step 14/15 : RUN ln -s /opt/app/node /usr/local/bin/ && ln -s /opt/app/keygenerator /usr/local/bin/ ---> Using cache ---> 977935286b28 Step 15/15 : CMD node --use-log-view ---> Using cache ---> 59409960d95e Successfully built 59409960d95e Successfully tagged elrond-node_elrond-2:latest Creating elrond-1 ... done Creating elrond-2 ... done j@optiplex980-1:~$ ctop
j@optiplex980-1:~ cd elrond-node j@optiplex980-1:~/elrond-node docker-compose up -d elrond-1 Creating elrond-1 ... done j@optiplex980-1:~/elrond-node docker-compose up -d elrond-2 Creating elrond-2 ... done j@optiplex980-1:~/elrond-node ctop
Workaround for now is to put --rm in the command line for copying the config files.
In your case, the problem could have occurred because you decided to use these commands without a proper understanding of the docker-compose
operation. Most likely for the command docker-compose run
you need to additionally use an additional argument (-T
- Disable pseudo-tty allocation. By default docker-compose run
allocates a TTY.). Also, to stop the nodes, I recommend that you use the docker-compose down
command.
For you, I added a small script that, when launching the node, checks the configuration files and if they are not there, it creates them myself. So it is with the wallet.
I also updated the instructions.
The container to copy the config files does not end properly and automatically restarts over and over and has to be manually stopped (it does copy the config files successfully). This also happened with the keygenerator container in the previous repository (using golang 1.12 & elrond 1.14), and I resolved that by commenting out the "restart always" in the docker compose file. However, this issue does not occur when using the docker multiple compose file.
!/bin/bash
git clone https://github.com/mrz1703/elrond-node.git cd elrond-node docker-compose build
docker-compose run -w /opt/app/config elrond sh -c "keygenerator > output_keys"
docker-compose run -w /opt/app/config elrond sh -c "cp /tmp/config/* /opt/app/config/" docker-compose up -d