latest(Dockerfile)
For running bitcoind or bitcoin-cli in a docker container.
In order to switch from user and password based authentication (using -rpcuser and -rpcpassword) to -rpcauth it is worth mentioning, that the docker image needs to be configured in a certain way (using environment variables):
RPC_AUTHis set and is not"".-rpcauth=$RPC_AUTHis used.RPC_USERandRPC_PASSWORDare ignored, even if set.
RPC_AUTHis not set or is""andRPC_USERandRPC_PASSWORDare set and are not"".-rpcuser=$RPC_USERand-rpcpassword=$rPC_PASSWORDwill be used.
A few more words about -rpcauth:
- Create a value for
-rpcauth(RPC_AUTH):- Run the script
rpcauth.pyto create credentials. - The script can be found in the official bitcoin github repository:
share/rpcauth/rpcauth.py # Also have a look at the README file share/rpcauth/README.md- The result will be a string in the following format:
<username>:<salt>$<password_hmac>- This is what
RPC_AUTHis to be configured with.
- Additionally you will get a
<password>which is to be used to configure the clients connecting to the bitcoind RPC.- The
<password>is used to create<password_hmac>.
- The
- Run the script
Not specifying a host port in -p <host_port>:<container_port> docker will automatically assign a free port on the host.
docker run --rm -d -p 8332 -v <path/to/and/including/wallets>:/bitcoin normoes/bitcoin -datadir=/bitcoin
However, this only works for the common Bitcoin network ports:
833283331833218333