Git Product home page Git Product logo

docker-bitcoind's Introduction

docker-bitcoind

Docker Pulls Docker Image Size GitHub Donate Bitcoin Donate Lightning Donate

Run a full Bitcoin node with one command

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

Usage

docker run --name bitcoind -v $HOME/.bitcoin:/data/.bitcoin -p 8333:8333 lukechilds/bitcoind

JSON-RPC

To query bitcoind, execute bitcoin-cli from within the container:

docker exec -it bitcoind bitcoin-cli getnetworkinfo

To access JSON-RPC from other services you'll also need to expose port 8332. You probably only want this available to localhost:

docker run --name bitcoind -v $HOME/.bitcoin:/data/.bitcoin \
  -p 8333:8333 \
  -p 127.0.0.1:8332:8332 \
  lukechilds/bitcoind

You could now query JSON-RPC via cURL like so:

curl --data '{"jsonrpc":"1.0","id":"curltext","method":"getnetworkinfo"}' \
  http://$(cat $HOME/.bitcoin/.cookie)@127.0.0.1:8332

CLI Arguments

All CLI arguments are passed directly through to bitcoind.

You can use this to configure via CLI args without a config file:

docker run --name bitcoind -v $HOME/.bitcoin:/data/.bitcoin \
  -p 8333:8333 \
  -p 127.0.0.1:8332:8332 \
  lukechilds/bitcoind -rpcuser=jonsnow -rpcpassword=ikn0wnothin

Or just use the container like a bitcoind binary:

$ docker run lukechilds/bitcoind -version
Bitcoin Core Daemon version v0.18.1
Copyright (C) 2009-2019 The Bitcoin Core developers

Please contribute if you find Bitcoin Core useful. Visit
<https://bitcoincore.org> for further information about the software.
The source code is available from <https://github.com/bitcoin/bitcoin>.

This is experimental software.
Distributed under the MIT software license, see the accompanying file COPYING
or <https://opensource.org/licenses/MIT>

This product includes software developed by the OpenSSL Project for use in the
OpenSSL Toolkit <https://www.openssl.org> and cryptographic software written by
Eric Young and UPnP software written by Thomas Bernard.

Version

Run a specific version of bitcoind if you want.

docker run --name bitcoind -v $HOME/.bitcoin:/data/.bitcoin -p 8333:8333 lukechilds/bitcoind:v0.18.1

Build

Build this image yourself by checking out this repo, cd ing into it and running:

docker build -t lukechilds/bitcoind .

You can build a specific version by passing in the VERSION build arg:

docker build --build-arg VERSION=0.18.1 -t lukechilds/bitcoind:v0.18.1 .

You can build a specific architecture by passing in the ARCH build arg:

docker build --build-arg ARCH=amd64 -t lukechilds/bitcoind:amd64 .

For a full list of supported build arg options, check out the build script matrix.

License

MIT © Luke Childs

docker-bitcoind's People

Contributors

lukechilds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jscorpio1611

docker-bitcoind's Issues

Autopush to Docker Hub on commit

Instead of automated builds via Docker Hub pulling, we should push from our CI process.

It gives us much more control and allows us to build all versions from master rather than having a branch for each version.

Build different versions using Docker build arg

So we can do something like:

docker build --build-arg VERSION=0.19.0.1 -t lukechilds/bitcoind:v0.19.0.1 .

to build a specific version.

By default latest version is always built.

We could also use this to add automated testing/publishing using a Travis/GH Actions matrix.

Create scratch variant with docker-slim

https://github.com/docker-slim/docker-slim

Quick tests show this does the trick:

docker-slim build --continue-after 1 lukechilds/bitcoind

Reduces image from 100MB to 15MB.

REPOSITORY                            TAG                 IMAGE ID            CREATED             SIZE
lukechilds/bitcoind                   latest              abc0893e81ad        5 days ago          101MB
lukechilds/bitcoind.slim              latest              f8eccb4eb4ed        6 minutes ago       15.5MB

Use tag *-scratch to differentiate and document that these builds are experimental.

e.g:

  • lukechilds/bitcoind:latest
  • lukechilds/bitcoind:latest-scratch
  • lukechilds/bitcoind:v0.19.0.1
  • lukechilds/bitcoind:v0.19.0.1-scratch

Add Tests

Test the Docker image works as expected with a GitHub action.

  • Test syncing to n blocks
  • Test bitcoin-cli can be called from docker exec
  • Test JSON-RPC can be called via cURL
  • ETC

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.