Easy Docker Guide for EOS

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)

H2
H3
H4
3 columns
2 columns
1 column
10 Comments