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

I am running the following docker command:

docker run --rm -it ruimarinho/bitcoin-core \
  -printtoconsole \
  -regtest=1 \
  -rpcallowip= \

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


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.