Skip to content

Commit 434b002

Browse files
author
Seonpyo Kim
committed
Add an explanation for managing data persistent
Added an explanation in the `Setup > Using Docker` section.
1 parent 66fb769 commit 434b002

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,23 @@ docker run -it codechain-io/codechain:branch_or_tag_name
5353

5454
This should result in CodeChain running.
5555

56+
#### Making local database and keys persistent
57+
58+
CodeChain depends on the local database and keys commonly stored under the directories `keys` and `db`. A Docker container is independent of host environment and other Docker images. Therefore, in case of running a new Docker container with an image with a new CodeChain version or even with the same image, the database and keys are not persistent. To solve the problem, one can take advantage of Docker's volume option. With the command below,
59+
```sh
60+
docker run -it -v codechain-db-vol:/app/codechain/db -v codechain-keys-vol:/app/codechain/keys codechain-io/codechain:branch_or_tag_name
61+
```
62+
one can mount the volume `codechain-db-vol` into `/app/db` and the volume `codechain-keys-vol` into `/app/keys` in the container. This command will automatically create volumes if existing volumes with specified names do not exist. Because the default working directory specified in `Dockerfile` is `/app/codechain`, the default db and keys path are `/app/codechain/db` and `app/codechian/keys`. One can also customize the paths with CodeChain cli arguments `base-path`, `key-path` and `db-path`.
63+
64+
```sh
65+
docker run -it -v codechain-db-vol:custom_base_path/db -v codechain-keys-vol:custom_base_path/keys codechain-io/codechain:branch_or_tag_name --base-path custom_base_path
66+
```
67+
68+
```sh
69+
docker run -it -v codechain-db-vol:custom_db_path -v codechain-keys-vol:custom_keys_path codechain-io/codechain:branch_or_tag_name --db-path custom_db_path --keys-path custom_keys_path
70+
```
71+
With the methods above, node organizers can manage their local persistent data using docker images.
72+
5673
### Building From Source
5774

5875
#### Build Dependencies

0 commit comments

Comments
 (0)