README.md 1.8 KB
Newer Older
S
Sandwich 已提交
1
# Run in docker
N
Nathan Hourt 已提交
2

H
Huang-Ming Huang 已提交
3
Simple and fast setup of EOS on Docker is also available.
S
Sandwich 已提交
4 5

## Install Dependencies
H
Huang-Ming Huang 已提交
6
 - [Docker](https://docs.docker.com) Docker 17.05 or higher is required
peterwillcn's avatar
peterwillcn 已提交
7

S
Sandwich 已提交
8
## Build eos image
peterwillcn's avatar
peterwillcn 已提交
9

S
Sandwich 已提交
10
```bash
peterwillcn's avatar
peterwillcn 已提交
11
git clone https://github.com/EOSIO/eos.git --recursive
H
Huang-Ming Huang 已提交
12 13
cd eos/Docker
docker build . -t eosio/eos
peterwillcn's avatar
peterwillcn 已提交
14 15
```

H
Huang-Ming Huang 已提交
16
## Start eosd docker container only
peterwillcn's avatar
peterwillcn 已提交
17

S
Sandwich 已提交
18
```bash
H
Huang-Ming Huang 已提交
19
docker run -p 8888:8888 -p 9876:9876 -t eosio/eos start_eosd.sh arg1 arg2
peterwillcn's avatar
peterwillcn 已提交
20
```
S
Sandwich 已提交
21

H
Huang-Ming Huang 已提交
22 23 24 25 26 27 28 29
## Start both eosd and walletd containers

```bash
docker-compose up
```

After `docker-compose up`, two services named eosd and walletd will be started. eosd 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 eosc when runing eosc is running inside the walletd container as described in "Execute eosc commands" section.

S
Sandwich 已提交
30 31 32
## Get chain info

```bash
peterwillcn's avatar
peterwillcn 已提交
33
curl http://127.0.0.1:8888/v1/chain/get_info
peterwillcn's avatar
peterwillcn 已提交
34 35
```

S
Sandwich 已提交
36
## Execute eosc commands
peterwillcn's avatar
peterwillcn 已提交
37

H
Huang-Ming Huang 已提交
38
You can run the `eosc` commands via a bash alias.
S
Sandwich 已提交
39 40

```bash
H
Huang-Ming Huang 已提交
41 42 43
alias eosc='docker-compose exec walletd /opt/eos/bin/eosc -H eosd'
eosc get info
eosc get account inita
peterwillcn's avatar
peterwillcn 已提交
44 45
```

H
Huang-Ming Huang 已提交
46 47
Upload sample exchange contract

S
Sandwich 已提交
48
```bash
H
Huang-Ming Huang 已提交
49
eosc set contract exchange contracts/exchange/exchange.wast contracts/exchange/exchange.abi
peterwillcn's avatar
peterwillcn 已提交
50 51
```

H
Huang-Ming Huang 已提交
52
If you don't need walletd afterwards, you can stop the walletd service using
S
Sandwich 已提交
53 54

```bash
H
Huang-Ming Huang 已提交
55 56 57 58 59 60 61 62 63 64 65 66 67 68
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.

```yaml
version: "2"

services:
  eosd:
    volumes:
      - eosd-data-volume:/opt/eos/bin/data-dir
      - ./config2.ini:/opt/eos/bin/data-dir/config.ini
S
Sandwich 已提交
69 70
```

H
Huang-Ming Huang 已提交
71
Then restart your docker containers like.
S
Sandwich 已提交
72 73

```bash
H
Huang-Ming Huang 已提交
74 75 76
docker-compose down
docker-compose up
```