kylemanna / docker-bitcoind

💰 Bitcoind Docker image that runs the Bitcoin node in a container for easy deployment
https://hub.docker.com/r/kylemanna/bitcoind/
MIT License
639 stars 408 forks source link

`btc_init` fails with `Permission denied` on `bitcoin.conf` creation #110

Open nkuba opened 1 year ago

nkuba commented 1 year ago

When I'm trying to run a Docker container with --user 1000:1000 the btc_init script fails with /usr/local/bin/btc_init: line 13: /bitcoin/.bitcoin/bitcoin.conf: Permission denied error.

Does it require some additional configuration?

Sample output:

$ docker run --user 1000:1000 kylemanna/bitcoind
+ btc_init
+ '[' '!' -e /bitcoin/.bitcoin/bitcoin.conf ']'
+ mkdir -p /bitcoin/.bitcoin
+ echo 'Creating bitcoin.conf'
Creating bitcoin.conf
+ cat
++ dd if=/dev/urandom bs=33 count=1
++ base64
/usr/local/bin/btc_init: line 13: /bitcoin/.bitcoin/bitcoin.conf: Permission denied
tonytech83 commented 6 months ago

I'm having the same problem.

docker:

docker run -d \
     -p 8333:8333 \
     -p 127.0.0.1:8332:8332 \
     --volume /mnt/test/bitcoind-data:/bitcoin/.bitcoin \
     --name bitcoind-node \
     --restart=unless-stopped \
     kylemanna/bitcoind

Output:

+ btc_init
+ '[' '!' -e /bitcoin/.bitcoin/bitcoin.conf ']'
+ mkdir -p /bitcoin/.bitcoin
+ echo 'Creating bitcoin.conf'
+ cat
Creating bitcoin.conf
++ dd if=/dev/urandom bs=33 count=1
++ base64
/usr/local/bin/btc_init: line 13: /bitcoin/.bitcoin/bitcoin.conf: Permission denied
dasilvatek commented 2 weeks ago

@nkuba please check the permissions for the target folder allow user id 1000 write access - you may want to mount a volume to know exactly what folder is being used: --volume /mnt/test/bitcoind-data:/bitcoin/.bitcoin

@tonytech83 please check your user id has write permissions to the folder and adjust as necessary - and you may want to specify the docker user if appropriate: ls -lh /mnt/test |grep bitcoind-data chmod u+w /mnt/test/bitcoind-data docker run --user 1000:1000 ...