OSDN Git Service

580e39cdd40d8206312814a43d982058ba92a93a
[bytom/vapor.git] / docs / Running-in-Docker.md
1 ## Running in Docker
2
3 ### Build the image
4
5 ```bash
6 $ docker build -t vapor .
7 ```
8
9 ### Enter the iterative mode
10
11 ```bash
12 $ docker run -it --net=host -v <vapor/data/directory/on/host/machine>:/root/.vapor vapor:latest
13 ```
14
15 vapor data directory has three config files:
16
17 - `config.toml`
18 - `federation.json`
19 - `node_key.txt`
20
21 Then you can use bytomd and bytomcli following [Bytom Wiki](https://github.com/Bytom/bytom/wiki/Command-Line-Options).
22
23 Use `exit` to exit Docker's iterative mode.
24
25 ### Daemon mode
26
27 For example,
28
29 ```bash
30 $ docker run -d --net=host -v <vapor/data/directory/on/host/machine>:/root/.vapor vapor:latest bytomd node --web.closed --auth.disable
31 ```
32
33 __To list the running containners and check their container id, image, corresponding command, created time, status, name and ports being used:__
34
35 ```bash
36 $ docker container ls
37 ```
38
39 or
40
41 ```bash
42 $ docker ps
43 ```
44
45 __To execute a command inside a containner, for example:__
46
47 ```bash
48 $ docker exec -it <containerId> bytomcli create-access-token <tokenId>
49 ```
50
51 __To stop a running containner:__
52
53 ```bash
54 $ docker stop <containerId>
55 ```
56
57 __To remove a containner:__
58
59 ```bash
60 $ docker rm <containerId>
61 ```