Easy Docker Guide for EOS

in #eoskorea7 years ago

My previous post EOS Build Guide on Ubuntu provides instructions to build EOS on native machine. But Docker has many advantages, especially compatibility, so that providing information for Docker users sounds a good idea to me. This post is a brief guide of using EOS (eosd, eosc). Example contracts are not available since Dockerfile in the official repo deletes them after building, but I think we can make easy modifications soon.

Install Docker

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
apt-cache policy docker-ce
sudo apt-get install -y docker-ce git
sudo systemctl status docker

Install Docker-compose (maybe optional)

sudo curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.11.2/docker-compose-$(uname -s)-$(uname -m)"
sudo chmod +x /usr/local/bin/docker-compose
docker-compose -v
sudo usermod -aG docker $USER

Build docker image

screen -S dockerbuild
git clone https://github.com/EOSIO/eos
cd eos/Docker
cp ../genesis.json .

We need to add plugin to use eosc, until EOS devs fix it.
nano config.ini

Add the following
plugin = eos::chain_api_plugin

Build

sudo docker build --rm -t eosio/eos .

Optional

sudo rm -rf /data/store/eos
sudo mkdir -p /data/store/eos

Run Docker

sudo docker run --rm --name eos -d -p 8888:8888 -p 9876:9876 eosio/eos
sudo docker logs --tail 10 eos    # Check log

Run eosc

sudo docker exec eos /opt/eos/bin/eosc info
sudo docker exec eos /opt/eos/bin/eosc create key
sudo docker exec eos /opt/eos/bin/eosc create account eos tester EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq EOS6KdkmwhPyc2wxN9SAFwo2PU2h74nWs7urN1uRduAwkcns2uXsa
sudo docker exec eos /opt/eos/bin/eosc transfer eos tester 1000
sudo docker exec eos /opt/eos/bin/eosc account tester

(Example contracts are under tmp/eos/contracts which were deleted in Dockerfile)

Sort:  

Thank you again for keeping us updated on the latest EOS developments you're working with. I hope to carve off some time this weekend to play around with all of this. :)

Been playing with this today and mentioned this issue in the Telegram as well:

CMake Error at /opt/cmake/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find GMP (missing: GMP_LIBRARIES GMP_INCLUDE_DIR)
Call Stack (most recent call first):
  /opt/cmake/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)
  libraries/fc/CMakeModules/FindGMP.cmake:50 (find_package_handle_standard_args)
  libraries/fc/CMakeLists.txt:20 (find_package)

I was told sudo apt-get install libgmp3-dev would do the trick, but it errored again, so now I'm attempting a build with --no-cache. I'm building on Google Compute Engine. Having fun so far. I hope I can get it going. :)

Edit: Ah, looks like a PR has been submitted and merged with a fix for this: https://github.com/EOSIO/eos/pull/105/files

Thanks, this is going to be fun!

Just posted this article that talks about EOS as the 4th generation blockchain challenge for Steem.

Analysis of Steem's Economy - A Social Scientist's First Impressions - Part 3/4 in the series.

https://steemit.com/steemit/@cyberspace/analysis-of-steem-s-economy-a-social-scientist-s-first-impressions-part-3-4

Thank you for the tut.

thank you for info

This post received a 2.3% upvote from @randowhale thanks to @cayce! For more information, click here!