This post is from a low-reputation account and contains an unverified outbound link. Be cautious before clicking external links.

Develop EOS in docker

Words
229
Reading
2 min
Listen
Play
9y

In github, EOS has already give a Dockfile to run eos in Docker. Also you could develop EOS in Docker with litter change:

1 clone eos github in your local path

git clone https://github.com/EOSIO/eos.git —recursive

2 don’t build eos when build docker image, and change the image entrypoint

  • remove following lines in eos/Docker/Dockerfile

-COPY . /tmp/eos/
-RUN cd /tmp/eos/build && cmake -DWASM_LLVM_CONFIG=/opt/wasm/bin/llvm-config -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/opt/eos ../
- && make -j$(nproc) && make install && mv ../contracts /
- && ln -s /opt/eos/bin/eos* /usr/local/bin
- && rm -rf /tmp/eos*

  • change the entry point

-ENTRYPOINT ["/sbin/entrypoint.sh"]
+ENTRYPOINT ["/bin/bash"]

3 build docker image in eos/Docker

docker build -t eosio/eos -f Docker/Dockerfile .

4 run docker image

docker run -it -v /local/path/to/eos:/tmp/eos eosio/eos

5 build eos in docker container's bash

mkdir -p /tmp/eos/installpath/data-dir && cd /tmp/eos && mkdir build && cd build
&& WASM_LLVM_CONFIG=/opt/wasm/bin/llvm-config cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/tmp/eos/installpath ../
&& make -j$(nproc) && make install

After the built finished, the eos will be install in /tmp/eos/installpath.

6 run EOS in the docker’s bash.

  • copy config.ini and genesis.json

cp /tmp/eos/Docker/config.ini /tmp/eos/genesis.json /tmp/eos/installpath/data-dir

  • change genesis.jso path in config.ini

genesis-json = "/tmp/eos/installpath/data-dir/genesis.json”

  • run docker

cd /tmp/eos/installpath && bin/eosd --data-dir ./data-dir

With this eos image, you can change the eos code in you local machine, and rebuild the EOS in the docker container. The build result will exist in your local machine.

Develop EOS in docker | Ecency