0

I am using this docker image and trying to use bitcoin-cli commands. When I run `bitcoin-cli help, I get the error:

root@5c7c6e54f180:/# bitcoin-cli help
error: timeout on transient error: Could not connect to the server 127.0.0.1:8332

I am running the following docker command:

docker run --rm -it ruimarinho/bitcoin-core \
  -printtoconsole \
  -regtest=1 \
  -rpcallowip=172.17.0.0/16 \
  -rpcauth='foo:7d9ba5ae63c3d4dc30583ff4fe65a67e$9e3634e81c11659e3de036d0bf88f89cd169c1039e6e09607562d54765c649cc'

docker ps returns the following:

 ~ docker ps
CONTAINER ID   IMAGE                     COMMAND                  CREATED         STATUS         PORTS                                                              NAMES
5c7c6e54f180   ruimarinho/bitcoin-core   "/entrypoint.sh -pri…"   7 minutes ago   Up 7 minutes   8332-8333/tcp, 18332-18333/tcp, 18443-18444/tcp, 38332-38333/tcp   charming_chatterjee

I want to connect either testnet or regtest

1 Answer 1

2

You'll need to expose the ports you want to use, Docker doesn't do this automatically. The port depends on which network you want to use. This is documented on the homepage of the Docker image you're using: https://github.com/ruimarinho/docker-bitcoin-core#exposing-ports

Furthermore, when running bitcoin-cli you also need to specify which network you're using, e.g. bitcoin-cli -regtest help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.