BITCOIN_NETWORK: The network on which the node will run, available values: mainnet, testnet, regtest
BITCOIN_EXTRA_ARGS: The configuration parameters of bitcoin core
If your container mycontainer is running, you can use bitcoin-cli the following way to communicate with your node:
docker exec -ti mycontainer bitcoin-cli -datadir="/data" help
The following example show a docker compose exposing one service called bitcoind which rely on our image.
rpcport=43782 means that the node will listen on port 43782 for RPC commands inside the containerport=39388 means that the node will listen on port 43782 for P2P messages inside the containerwhitelist=0.0.0.0/0 means that P2P clients will be whitelisted (connection can't be refused even if incoming slots are full)prune=50000 means that we will prune the blockchain to keep a worse 50 GB of blocks.We then expose the ports to other services in this docker-compose wanting to connect to us.
The persistent data is saved in the bitcoin_datadir volume.
You can try it by creating docker-compose.yml with:
version: "3"
services:
bitcoind:
restart: unless-stopped
image: metacosa/bitcoin:0.17.0
environment:
BITCOIN_NETWORK: mainnet
BITCOIN_EXTRA_ARGS: |
rpcport=43782
port=39388
whitelist=0.0.0.0/0
prune=50000
expose:
- "43782"
- "39388"
volumes:
- "bitcoin_datadir:/data"
volumes:
bitcoin_datadir:
Then running it docker-compose up.
Content type
Image
Digest
Size
28.5 MB
Last updated
over 7 years ago
docker pull metacosa/bitcoin:0.17.0