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:qDDZdeQ5vw9XXFeVnXT4PZ--tGN2xNjjR4nrtyszZx0=@127.0.0.1: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.