Skip to content

Latest commit

 

History

History
 
 

Docker

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Run in docker

Simple and fast setup of EOS.IO on Docker is also available.

Install Dependencies

  • Docker Docker 17.05 or higher is required

Docker Requirement

  • At least 8GB RAM (Docker -> Preferences -> Advanced -> Memory -> 8GB or above)

Build eos image

git clone https://github.com/EOSIO/eos.git --recursive
cd eos/Docker
docker build . -t eosio/eos

Start nodeos docker container only

docker run --name nodeos -p 8888:8888 -p 9876:9876 -t eosio/eos start_nodeos.sh arg1 arg2

By default, all data is persisted in a docker volume. It can be deleted if the data is outdated or corrupted:

$ docker inspect --format '{{ range .Mounts }}{{ .Name }} {{ end }}' nodeos
fdc265730a4f697346fa8b078c176e315b959e79365fc9cbd11f090ea0cb5cbc
$ docker volume rm fdc265730a4f697346fa8b078c176e315b959e79365fc9cbd11f090ea0cb5cbc

Alternately, you can directly mount host directory into the container

docker run --name nodeos -v /path-to-data-dir:/opt/eosio/bin/data-dir -p 8888:8888 -p 9876:9876 -t eosio/eos start_nodeos.sh arg1 arg2

Get chain info

curl http://127.0.0.1:8888/v1/chain/get_info

Start both nodeos and walletd containers

docker-compose up

After docker-compose up, two services named nodeos and walletd will be started. nodeos service would expose ports 8888 and 9876 to the host. walletd service does not expose any port to the host, it is only accessible to cleos when runing cleos is running inside the walletd container as described in "Execute cleos commands" section.

Execute cleos commands

You can run the cleos commands via a bash alias.

alias cleos='docker-compose exec walletd /opt/eosio/bin/cleos -H nodeos'
cleos get info
cleos get account inita

Upload sample exchange contract

cleos set contract exchange contracts/exchange/exchange.wast contracts/exchange/exchange.abi

If you don't need walletd afterwards, you can stop the walletd service using

docker-compose stop walletd

Change default configuration

You can use docker compose override file to change the default configurations. For example, create an alternate config file config2.ini and a docker-compose.override.yml with the following content.

version: "2"

services:
  nodeos:
    volumes:
      - nodeos-data-volume:/opt/eosio/bin/data-dir
      - ./config2.ini:/opt/eosio/bin/data-dir/config.ini

Then restart your docker containers as follows:

docker-compose down
docker-compose up

Clear data-dir

The data volume created by docker-compose can be deleted as follows:

docker volume rm docker_nodeos-data-volume