Sign inSign up

ru1p/bitcoin-node

By ru1p

Updated 4 months ago

A Bitcoin Node based on Bitcoin Core or Knots depending on the requested tag.

Image
Networking
0

688

ru1p/bitcoin-node repository overview

Use tag 'core' or 'knots' according your preference. At container start 'bitcoind' is executed. The blockchain will be saved in folder '/home/bitcoin-node-data' within the container. This folder has to be mapped to a persistent volume on the host. Further 'bitcoind' arguments may be appended in the command section.

Zero trust? No worries. To build your own image please download the compressed Bitcoin Core or Knots file and save it in the same folder as the Dockerfile. Recommended and secure download sites are https://bitcoincore.org/en/download and https://bitcoinknots.org/#download .

Feel free to use the examples below and adjust them to your individual needs. Have fun!

### Dockerfile ###
## Bitcoin Node - Usable for Bitcoin Core and Knots ##

# Get the latest Debian base image
FROM debian:latest

# Set '/home' as working directory to install the Bitcoin Node
WORKDIR /home

# Copy compressed Bitcoin Node (core/knots) file to working directory
COPY bitcoin*.tar.gz .

# Run commands during build
RUN tar xzf bitcoin*tar.gz \
    # Decompress Bitcoin Node file and cleanup
    && rm *.tar.gz \
    # Name app folder as 'bitcoin-node'
    && mv bitcoin* bitcoin-node \
    # Create blockchain data directory
    && mkdir bitcoin-node-data \
    # Update package sources and upgrade OS
    && apt-get update && apt-get upgrade -y

# On container start launch the Bitcoin Node
ENTRYPOINT ["./bitcoin-node/bin/bitcoind","-datadir=/home/bitcoin-node-data"]

### docker-compose.yml ###

services:
  bitcoin-node:
    # Tags: core, core-aarch24, knots, knots-aarch64
    image: ru1p/bitcoin-node:core
    container_name: bitcoin-node
    hostname: bitcoin-node
    restart: unless-stopped
    volumes:
      # Set blockchain data folder on the host (> 1.5 TB recommended)
      - /path/to/bitcoin-node-data:/home/bitcoin-node-data
      # Use host as time source
      - /etc/localtime:/etc/localtime:ro
    # Port forwarding required to be accessed by
    # other nodes or apps
    ports:
      - 8332:8332/tcp
      - 8333:8333/tcp
      - 8433:8433/tcp
    # Apply the command section below to enable block exploration
    # (e.g. mempool), not required for node operation
    command:
      # Enable transaction database indexing
      - "-txindex"
      # Enable rpc server
      - "-server"
      # Set rpc and zmq listening with care
      # Restrict public access!
      - "-rpcbind=0.0.0.0"
      - "-rpcallowip=0.0.0.0/0"
      - "-zmqpubhashblock=tcp://0.0.0.0:8433"
      # Set credentials to access the rpc interface,
      # create them using the python script in share/rpcauth
      - "-rpcauth=<username>:<password-hash>"

Tag summary

Content type

Image

Digest

sha256:ab00143b5

Size

166.6 MB

Last updated

4 months ago

docker pull ru1p/bitcoin-node:knots