Blockstream / esplora

Explorer for Bitcoin and Liquid
MIT License
1.01k stars 401 forks source link

Expose API during Docker deployment #488

Open scolear opened 8 months ago

scolear commented 8 months ago

I am running the esplora Docker image as per the README with the API port exposed:

$ docker run -p 50001:50001 -p 8094:80 -p 3000:3000 \ 
--volume $PWD/data_bitcoin_regtest:/data \
--rm -i -t -e  blockstream/esplora bash -c "/srv/explorer/run.sh bitcoin-regtest explorer"

But in this configuration, there is no access to the API from the outside, which I would want. I have tried all kinds of hacks, but it seems there is no way to do this without creating a custom electrs Docker image? As per this and this issue.

Accessing the API fails (it is set to 127.0.0.1:3000 instead of 0.0.0.0:3000, so understandable, but why not changeable?):

$ curl localhost:3000
curl: (56) Recv failure: Connection reset by peer

Trying access through the web interface just returns HTML:

$ curl http://localhost:8094/api/blocks/tip/
<!DOCTYPE html><head><meta charset="utf-8"><title>Bitcoin Regtest Explorer</title>......

Any help would be appreciated. Is there an easy way to expose the API?