Skip to content

depach/bitcoind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

bitcoind

Docker hub: depach/bitcoind

Docker image of Bitcoin core bitcoind built from sources on ubuntu

forked from jamesob/docker-bitcoind - many thanks!

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' \
   --volume /home/youruser/bitcoin_data:/root/.bitcoin \
   -p 127.0.0.1:8332:8332 \
   --publish 8333:8333 \
   depach/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 172.0.0.0/8
BTC_RPCCLIENTTIMEOUT 30
BTC_DISABLEWALLET 1
BTC_TXINDEX 0
BTC_TESTNET 0
BTC_DBCACHE 0
BTC_ZMQPUBHASHTX tcp://0.0.0.0:28333
BTC_ZMQPUBHASHBLOCK tcp://0.0.0.0:28333
BTC_ZMQPUBRAWTX tcp://0.0.0.0:28333
BTC_ZMQPUBRAWBLOCK tcp://0.0.0.0:28333

Daemonizing

The smart thing to do if you're daemonizing is to use Docker's builtin restart policies, but if you're insistent on using systemd, you could do something 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 depach/bitcoind
ExecStart=/usr/bin/docker run \
    --name bitcoind \
    -p 8333:8333 \
    -p 127.0.0.1:8332:8332 \
    -v /data/bitcoind:/root/.bitcoin \
    depach/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.

About

Docker Bitcoin Core built from source

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •