Skip to content

Running in Docker

martinbtm edited this page Sep 6, 2021 · 1 revision

Running in Docker

Build the image

docker build -t bytom .

Init bytom

docker run -v <Bytom/data/directory/on/host/machine>:/root/.bytom bytom:latest bytomd init --chain_id <chainId>

The default Bytom data directory (on the host) is:

  • Mac: ~/Library/Bytom
  • Linux: ~/.bytom
  • Windows: %APPDATA%\Bytom

Enter the iterative mode

docker run -it -p 9888:9888 -v <Bytom/data/directory/on/host/machine>:/root/.bytom bytom:latest

Then you can use bytomd and bytomcli following Readme

Use exit to exit Docker's iterative mode

Daemon mode

For example,

docker run -d -p 9888:9888 -v <Bytom/data/directory/on/host/machine>:/root/.bytom bytom:latest bytomd node --web.closed --auth.disable

To list the running containners and check their container id, image, corresponding command, created time, status, name and ports being used:

docker container ls

or

docker ps

To execute a command inside a containner, for example:

docker exec -it <containerId> bytomcli create-access-token <tokenId>

To stop a running containner:

docker stop <containerId>

To remove a containner:

docker rm <containerId>