Home > OS >  BTC core: empty reply with docker compose
BTC core: empty reply with docker compose

Time:09-08

For a personal project I need to run an BTC core docker image. I can run the docker image using a command and when I send a request, I receive the correct reply.

When I try to run the same docker image in a docker-compose file I expect the same result. However, I get this response: "Empty reply from server".

The command that works:

docker run --rm -it -p 8332:8332 -p 8333:8333 ruimarinho/bitcoin-core -printtoconsole  -rpcallowip=172.17.0.0/16 -rpcbind=0.0.0.0  --rpcuser=foo --rpcpassword="qDDZdeQ5vw9XXFeVnXT4PZ--tGN2xNjjR4nrtyszZx0="

The reply:

{"result":{"version":230000,"subversion":"/Satoshi:23.0.0/","protocolversion":70016,"localservices":"0000000000000409","localservicesnames":["NETWORK","WITNESS","NETWORK_LIMITED"],"localrelay":true,"timeoffset":3,"networkactive":true,"connections":8,"connections_in":0,"connections_out":8,"networks":[{"name":"ipv4","limited":false,"reachable":true,"proxy":"","proxy_randomize_credentials":false},{"name":"ipv6","limited":false,"reachable":true,"proxy":"","proxy_randomize_credentials":false},{"name":"onion","limited":true,"reachable":false,"proxy":"","proxy_randomize_credentials":false},{"name":"i2p","limited":true,"reachable":false,"proxy":"","proxy_randomize_credentials":false},{"name":"cjdns","limited":true,"reachable":false,"proxy":"","proxy_randomize_credentials":false}],"relayfee":0.00001000,"incrementalfee":0.00001000,"localaddresses":[],"warnings":""},"error":null,"id":"1"}

The docker compose file:

version: '3.8'
services:
  bitcoin-core:
    image: ruimarinho/bitcoin-core
    command:
      -printtoconsole
      -rpcallowip=172.17.0.0/16
      -rpcbind=0.0.0.0
      --rpcuser=foo
      --rpcpassword="qDDZdeQ5vw9XXFeVnXT4PZ--tGN2xNjjR4nrtyszZx0="
    ports:
      - "8332:8332"
      - "8333:8333"

The reply:

"Empty reply from server"

This is the request I send:

curl --data-binary "{\"jsonrpc\":\"1.0\",\"id\":\"1\",\"method\":\"getnetworkinfo\"}"  http://foo:[email protected]:8332/

This question and this issue seem to regard a similar problem. However, these issues were resolved by modifying mistakes made when passing environment variables and I don’t state any environment variables.

CodePudding user response:

When scrolling through the hub.docker description of
the image you are using there is a step where they call:

-rpcauth='foo:7d9ba5ae63c3d4dc30583ff4fe65a67e$9e3634e81c11659e3de036d0bf88f89cd169c1039e6e09607562d54765c649cc'
-rpcpassword="qDDZdeQ5vw9XXFeVnXT4PZ--tGN2xNjjR4nrtyszZx0="

You can find this info directly above Exposing Ports here

CodePudding user response:

I managed to get it to work using an older version of the docker image, using this docker compose file:

version: '3.8'
services:
  bitcoin-core:
    image: ruimarinho/bitcoin-core:0.17
    command:
      -printtoconsole
      -rest
      -rpcallowip=::/0
      -rpcport=8332
      --rpcuser=foo
      --rpcpassword="qDDZdeQ5vw9XXFeVnXT4PZ--tGN2xNjjR4nrtyszZx0="
      -server
    ports:
      - "8332:8332"

Sadly, it does not work when using the latest version of the docker image.

  • Related