mirror of
https://github.com/Retropex/docker-bitcoind.git
synced 2025-06-04 00:02:35 +02:00
93 lines
2.5 KiB
Markdown
93 lines
2.5 KiB
Markdown
# docker-bitcoind
|
|
|
|
 
|
|
|
|
This Dockerfile is based on the excellent work from [ruimarinho/docker-bitcoin-core](https://github.com/ruimarinho/docker-bitcoin-core/).
|
|
|
|
The changes from upstream include:
|
|
|
|
* removal of everything except the very minimal `alpine` images for the latest `bitcoin` version
|
|
* separation of `berkeleydb` stage into a separate [image]
|
|
* removal of the entrypoint
|
|
* removal of an extra user
|
|
* overall simplifications and following defaults
|
|
* more…
|
|
|
|
[image]: https://hub.docker.com/r/lncm/berkeleydb
|
|
|
|
> **NOTE:** ZMQ `block` and `tx` ports are set to `28332` and `28333` respectively.
|
|
|
|
|
|
## Tags
|
|
|
|
* `latest`, `0.17`, `0.17.1` - currently _latest_ version of Bitcoin Core for both `arm` and `amd64`
|
|
* `0.17.1-linux-arm` - Bitcoin Core version 0.17.1 for `arm` architecture (built manually on an RBP)
|
|
* `0.17.1-linux-amd64` - Bitcoin Core version 0.17.1 for `amd64` architecture (built via CI)
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
### Pull
|
|
|
|
First pull the image from [Docker Hub]:
|
|
|
|
```bash
|
|
docker pull lncm/bitcoind:0.17.1
|
|
```
|
|
|
|
> **NOTE:** Running above will automatically choose native architecture of your CPU.
|
|
|
|
[Docker Hub]: https://hub.docker.com/r/lncm/bitcoind
|
|
|
|
|
|
#### Start
|
|
|
|
Then to start bitcoind, execute:
|
|
|
|
```bash
|
|
docker run -it --rm \
|
|
-v ~/.bitcoin:/root/.bitcoin \
|
|
-p 8332:8332 \
|
|
-p 8333:8333 \
|
|
-p 28332:28332 \
|
|
-p 28333:28333 \
|
|
--name bitcoind \
|
|
--detach \
|
|
lncm/bitcoind:0.17.1
|
|
```
|
|
|
|
That will run bitcoind such that:
|
|
|
|
* all data generated by the container is stored in `~/.bitcoin` **on your host machine**,
|
|
* port `8332` will be reachable for the RPC communication,
|
|
* port `8333` will be reachable for the peer-to-peer communication,
|
|
* port `28332` will be reachable for ZMQ **block** notifications,
|
|
* port `28333` will be reachable for ZMQ **transaction** notifications,
|
|
* created container will get named `bitcoind`,
|
|
* that command will run the container in the background and print the ID of the container being run.
|
|
|
|
|
|
#### Interact
|
|
|
|
To issue any commands to a running container, do:
|
|
|
|
```bash
|
|
docker exec -it bitcoind BINARY COMMAND
|
|
```
|
|
|
|
Where:
|
|
* `BINARY` is either `bitcoind` or `bitcoin-cli`, and
|
|
* `COMMAND` is something you'd normally pass to the binary
|
|
|
|
Examples:
|
|
|
|
```bash
|
|
docker exec -it bitcoind bitcoind --help
|
|
docker exec -it bitcoind bitcoind --version
|
|
docker exec -it bitcoind bitcoin-cli --help
|
|
docker exec -it bitcoind bitcoin-cli -getinfo
|
|
docker exec -it bitcoind bitcoin-cli getblockcount
|
|
```
|
|
|