call bitcoind rpc api over docker

  bitcoind, docker, docker-container, rpc

I started my node container with this flags:

daemon=1
printtoconsole=1
testnet=1
rpcport=9332
rpcallowip=0.0.0.0/0
rpcuser=user
rpcpassword=password
rpcbind=0.0.0.0
server=1

I opened port in my docker-compose :

node:
    image: bitcoin-sv
    container_name: 'node'
    restart: always
    ports:
      - '9332:9332'

I can call methods from bitcoin-cli in my container

docker exec -it node bash
[email protected]:/opt/bitcoin-sv# ./bitcoin-cli getinfo

But I cannot call it from curl

curl --user user --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo, "params": ["", 0.1, "donation", "seans outpost"] }' -H 'content-type: text/plain;' http://127.0.0.1:9332
Enter host password for user 'user':
curl: (52) Empty reply from server

How can i call it from curl? Maybe i have to call to cli?

Source: Docker Questions

LEAVE A COMMENT