How to set up EOS using docker?

EOS main net is out currently. Still, the importance of single node local test net doesn't diminish. If you want to create your own eos blockchain with multiple nodes, it is possible by configuring them accordingly.  Normal installation requires downloading a lot of files and later building. The building process is a time-consuming process and a 7GB ram is required to do that. Solution to this is set up using docker, which is very fast and simple.

- Ready to use images are available (no need to build image)
- No need of 7 gb ram
- Very fast and lightweight
This blog assumes you have, 
- Docker version 17.05 or higher
- docker-compose version 1.10.0 or higher
installed on your system.

Step 1
- pull images from its docker-hub
docker pull eosio/eos-dev
Step 2
- to start node
sudo 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= --access-control-allow-origin=* --contracts-console"
- Check its working:
sudo docker logs --tail 10 eosio
- Also, go to this address in the browser to check that RPC interface is working:
Step 3
For convenience, create a bash alias for cleos and eosiocpp tool. In the terminal, run:
alias cleos='docker exec eosio /opt/eosio/bin/cleos --wallet-url http://localhost:8888'
alias eosiocpp='docker exec eosio /opt/eosio/bin/eosiocpp'
- check its working using,
cleos get info
Step 4
- For further experimentation, it is better to bash into the container
docker exec -it $(docker ps -aqf "name=eosio") bash
- This will enter into the docker container as root.
- List its contents using
$ ls
Step 5
What's are you waiting for? 
Go building crazy dapps. Write your own contracts, compile into WASM, deploy and test
If you want to compile a new contract, you can do it with eosiocpp tool, which is in opt/eosio/bin.



Leave a comment