3

I have used docker to install EOS and to run nodeos. Here are the containers -

docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                            NAMES
39d42adc46cc        eosio/eos           "/opt/eosio/bin/keos…"   10 hours ago        Up 10 hours                                                          docker_keosd_1
7af14e3c1b23        eosio/eos           "/opt/eosio/bin/node…"   10 hours ago        Up 10 hours         0.0.0.0:8888->8888/tcp, 0.0.0.0:9876->9876/tcp   docker_nodeosd_1

I need to add a plugin for history, for example - https://eosio-nodeos.readme.io/docs/history_api_plugin -

# config.ini
plugin = eosio::chain_plugin
plugin = eosio::mongo_db_plugin


# nodeos startup params
--plugin eosio::chain_plugin --plugin eosio::mongo_db_plugin

I guess I could use docker-compose down, change config.ini (and Dockerfile), and then up but I am unsure what impact that would have on persistent data and also that is not very convenient.

Is there a preferred way to add plugins to a docker container running nodeos? On a related point, I will need to add more nodes, so I assume there is an easy way to add more nodes also using docker, is that starting new containers (or does that mean defining a service in docker)?

Here is the Dockerfile -

FROM eosio/builder as builder
ARG branch=master
ARG symbol=SYS

RUN git clone -b $branch https://github.com/EOSIO/eos.git --recursive \
    && cd eos && echo "$branch:$(git rev-parse HEAD)" > /etc/eosio-version \
    && cmake -H. -B"/tmp/build" -GNinja -DCMAKE_BUILD_TYPE=Release -DWASM_ROOT=/opt/wasm -DCMAKE_CXX_COMPILER=clang++ \
       -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/tmp/build  -DSecp256k1_ROOT_DIR=/usr/local -DBUILD_MONGO_DB_PLUGIN=true -
DCORE_SYMBOL_NAME=$symbol \
    && cmake --build /tmp/build --target install && rm /tmp/build/bin/eosiocpp


FROM ubuntu:18.04

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssl ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/lib/* /usr/local/lib/
COPY --from=builder /tmp/build/bin /opt/eosio/bin
COPY --from=builder /tmp/build/contracts /contracts
COPY --from=builder /eos/Docker/config.ini /
COPY --from=builder /etc/eosio-version /etc
COPY --from=builder /eos/Docker/nodeosd.sh /opt/eosio/bin/nodeosd.sh
ENV EOSIO_ROOT=/opt/eosio
RUN chmod +x /opt/eosio/bin/nodeosd.sh
ENV LD_LIBRARY_PATH /usr/local/lib
VOLUME /opt/eosio/bin/data-dir
ENV PATH /opt/eosio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

1 Answer 1

1

You can start nodeos with this command, your plugin comes in bolded area.

docker run --rm --name eosio -d -p 8888:8888 -p 9876:9876 -v /tmp/work:/work -v /tmp/eosio/data:/mnt/dev/data -v /tmp/eosio/config:/mnt/dev/config eosio/eos-dev /bin/bash -c "nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::wallet_plugin --plugin eosio::producer_plugin --plugin eosio::history_plugin --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin --plugin eosio::http_plugin -d /mnt/dev/data --config-dir /mnt/dev/config --http-server-address=0.0.0.0:8888 --access-control-allow-origin=* --contracts-console --http-validate-host=false"

5
  • That is using docker run? I thought EOS recommended using docker-compose up and Dockerfile for docker build. If we use run then we need to code more. Also I understand we can just docker-compose down and change the files and then up. But really I want to be able to change EOS when it is running. Otherwise we need to down and up everytime we have a plugin to add. Aug 9, 2018 at 12:07
  • BTW for that reason I installed EOS locally :)
    – iobeta123
    Aug 9, 2018 at 12:14
  • I tried that. But it took ages. Docker is a quick install. Aug 9, 2018 at 12:29
  • It took 25-40 minutes on my machine.
    – iobeta123
    Aug 9, 2018 at 12:30
  • Really? It took me far longer. Maybe it is dependent on memory etc; also OS. Aug 9, 2018 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.