him0 / docker-bitcoind

Running a full bitcoin node ain't never been so easy!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-bitcoind

Docker Stars Docker Pulls

Running a full node ain't never been so easy!

A Docker configuration with sane defaults for running a full validating Bitcoin node.

Quick start

Requires that Docker be installed on the host machine.

# Create some directory where your bitcoin data will be stored.
$ mkdir /home/youruser/bitcoin_data

$ docker run --name bitcoind -d \
   --env 'BTC_RPCUSER=foo' \
   --env 'BTC_RPCPASSWORD=password' \
   --env 'BTC_TXINDEX=1' \
   --env 'BTC_RUN_ARGS="-reindex"' \  # Forwarded on to the bitcoind call.
   --volume /home/youruser/bitcoin_data:/bitcoin \
   -p 8332:8332
   --publish 8333:8333
   jamesob/bitcoind

$ docker logs -f bitcoind
[ ... ]

Configuration

A custom bitcoin.conf file can be placed in the mounted data directory. Otherwise, a default bitcoin.conf file will be automatically generated based on environment variables passed to the container:

name default
BTC_RPCUSER btc
BTC_RPCPASSWORD changemeplz
BTC_RPCPORT 8332
BTC_RPCALLOWIP ::/0
BTC_RPCCLIENTTIMEOUT 30
BTC_DISABLEWALLET 1
BTC_TXINDEX 0

Daemonizing

If you're using systemd, you can use a config file like

$ cat /etc/systemd/system/bitcoind.service

# bitcoind.service #######################################################################
[Unit]
Description=Bitcoind
After=docker.service
Requires=docker.service

[Service]
ExecStartPre=-/usr/bin/docker kill bitcoind
ExecStartPre=-/usr/bin/docker rm bitcoind
ExecStartPre=/usr/bin/docker pull jamesob/bitcoind
ExecStart=/usr/bin/docker run \
    --name bitcoind \
    -p 8333:8333 \
    -p 8332:8332 \
    -v /data/bitcoind:/bitcoin \
    jamesob/bitcoind
ExecStop=/usr/bin/docker stop bitcoind

to ensure that bitcoind continues to run.

Alternatives

  • docker-bitcoind: sort of the basis for this repo, but configuration is a bit more confusing.
  • docker-bitcoin: more complex, but more granular versioning. Includes XT & classic.

About

Running a full bitcoin node ain't never been so easy!


Languages

Language:Shell 96.8%Language:Makefile 3.2%