I have a micro-service watchblockchain
that makes requests on bitcoin
blockchain. When I use both services, everything works just fine.
Then I want to put those services in docker containers.
watchblockchain
cannot communicate with the bitcoin
docker.
I use docker image: kylemanna/bitcoind/
Here is my bitcoin.conf
file:
disablewallet=1
printtoconsole=1
rpcauth=jfjobidon:123...xyz
testnet=1
txindex=1
server=1
rpcport=8332
I can open a console in the bitcoin
container and verify that the blocks are downloading and I can make requests on the blockchain
ex: bitcoin-cli getblockcount
In watchblockchain
, I have this connection config:
var clientBTC = new bitcoin.Client({
host: 'bitcoin',
port: 8332,
user: 'jfjobidon',
pass: 'Lw.....='
});
And I mapped bitcoin
to 127.0.0.1 in my hosts file
My docker-compose.yml
:
version: "3"
services:
watchblockchain:
build: ./watchBlockchain
depends_on:
- redis
deploy:
replicas: 1
restart_policy:
condition: on-failure
redis:
image: redis:4.0
command: redis-server --appendonly yes
ports:
- "6379:6379"
deploy:
placement:
constraints: [node.role == manager]
command: redis-server --appendonly yes
When I launch: docker-compose up, I have the following error:
Error: connect ECONNREFUSED 127.0.0.1:8332
I think it is a network communication problem.
How can I get my watchblockchain
service to communication with the bitcoin
docker ?