lukechilds / docker-electrumx

Run an Electrum server with one command
MIT License
109 stars 124 forks source link

ERROR:Daemon:Forbidden #30

Closed fenidik closed 5 years ago

fenidik commented 5 years ago

Getting error with docker run

`docker run -v /home/ubuntu/electrumx:/data -e DAEMON_URL=http://x:y@11.11.12.11:8332 -e COIN=BitcoinSegwit -p 50002:50002 lukechilds/electrumx Generating a RSA private key ....................+++++ ......................................................................................................................................................+++++ writing new private key to '/data/electrumx.key'

INFO:electrumx:ElectrumX server starting INFO:electrumx:logging level: INFO INFO:Controller:Python version: 3.7.2 (default, Jan 30 2019, 23:45:31) [GCC 6.4.0] INFO:Controller:software version: ElectrumX 1.12 INFO:Controller:aiorpcX version: 0.18.1 INFO:Controller:supported protocol versions: 1.4-1.4.2 INFO:Controller:event loop policy: None INFO:Controller:reorg limit is 200 blocks INFO:Daemon:daemon #1 at 11.11.12.11:8332/ (current) INFO:DB:switching current directory to /data INFO:DB:using leveldb for DB backend ERROR:Daemon:Forbidden ERROR:root:task crashed: <Task finished coro=<Controller.serve() done, defined at /electrumx/electrumx/server/controller.py:81> exception=DaemonError('Forbidden')> Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/aiorpcX-0.18.1-py3.7.egg/aiorpcx/util.py", line 309, in check_task task.result() File "/electrumx/electrumx/server/controller.py", line 121, in serve await daemon.height() File "/electrumx/electrumx/server/daemon.py", line 274, in height self._height = await self._send_single('getblockcount') File "/electrumx/electrumx/server/daemon.py", line 172, in _send_single return await self._send(payload, processor) File "/electrumx/electrumx/server/daemon.py", line 130, in _send result = await self._send_data(data) File "/electrumx/electrumx/server/daemon.py", line 107, in _send_data raise DaemonError(text) electrumx.server.daemon.DaemonError: Forbidden`

Only adding --net=host option helps. Could you help to find out why I get the error?

Mave95 commented 5 years ago

You probably can't connect to your bitcoind from your docker container. Since Bitcoin Core 0.18.0 you have to set rpcbind AND rpcallowip. I do have these settings: rpcbind=0.0.0.0 rpcallowip=127.0.0.1 rpcallowip=172.17.0.0/16

fenidik commented 5 years ago

You probably can't connect to your bitcoind from your docker container.

I don't think so. I can access it from docker host. Why it can be inaccessible from container? Why --net=host option helps?

I suppose it's connected with docker bridge and NAT. I've opened rpcallowip only for docker host subnet.

Mave95 commented 5 years ago

My bitcoind runs on the host and the DAEMON_URL from electrumx uses the host's ip of the docker interface (172.17.0.1). You should try out these settings. With --net=host your container can access any port bound to your host like it's the host itself. Since bitcoind is configured out of the box to only allow loopback connections, the setting --net=host solves your connection problem.

fenidik commented 5 years ago

Ok. Got it. Probably @lukechilds should add a disclaimer about the situation when your bitcoind placed on docker host or even on remote server