ruimarinho / docker-bitcoin-core

A bitcoin-core docker image
https://hub.docker.com/r/ruimarinho/bitcoin-core/
MIT License
365 stars 209 forks source link

It maybe a silly question but... #54

Closed tonydspaniard closed 6 years ago

tonydspaniard commented 6 years ago

First of all, thank you very much for your work. I am running into an issue that it maybe silly as I am new to docker but I cannot connect to the RPC from my application.

When I do from console, all is smooth:

 $ docker exec bitcoincore_1 bitcoin-cli -regtest -rpcuser=rpcuser -rpcpassword=rpcpassword getmininginfo
{
  "blocks": 0,
  "currentblockweight": 0,
  "currentblocktx": 0,
  "difficulty": 4.656542373906925e-10,
  "errors": "",
  "networkhashps": 0,
  "pooledtx": 0,
  "chain": "regtest"
}

But when I try to connect from my app using an RPC client, it fails:

Message: cURL error 7: Failed to connect to bitcoincore port 8332: Connection refused (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

This is how I configured the services:

services:
  bitcoincore:
    image: ruimarinho/bitcoin-core:latest
    restart: always
    command:
      -printtoconsole
      -regtest=1
      -rpcuser=rpcuser
      -rpcpassword=rpcpassword
    ports:
      - "8332:8332"
  php:
    build: .
    ports:
      - "80:80"
    depends_on:
      - bitcoincore
      - mysqldb
    links:
      - bitcoincore:bitcoincore
      - mysqldb:mysqldb
    volumes:
       .... 

Any help would be highly appreciated. And apologies if its a lame question. Thanks in advance.

promag commented 6 years ago

Bad indentation in php service?

tonydspaniard commented 6 years ago

@promag Thanks for your answer, but that was bad copy paste from my part. The services are all functional. I know that "links" are also not longer necessary, and I can connect to the alias of "mysqldb". But when using the alias "bitcoincore", nothing. I cannot connect from the RPC client.

Not sure what I am doing wrong.

tonydspaniard commented 6 years ago

As I suspected, it was a silly mistake. I am using regtest network and therefore I should have opened the port 18332 and not the mainnet 8332.

Closing this issue. Thanks again for your work.

ruimarinho commented 6 years ago

Thanks @tonydspaniard, glad you found the issue!