Develop EOS in docker

in #eosdev7 years ago

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.

Sort:  

Congratulations @chengchen09! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You published your First Post
You got a First Vote

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

This is an interesting approach! Going to do some testing with this myself :)

Your solution can be achieved within the dockerfile and without removing the entrypoint, which removes the unnecessary manual steps of copying files. You can always enter the bash of a running container with something like sudo docker exec -i -t docker_eos_1 /bin/bash

Congratulations @chengchen09! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.23
TRX 0.22
JST 0.037
BTC 98709.14
ETH 3447.96
USDT 1.00
SBD 3.20