Using bitcoin-cli on embassy

Hello. The Bitcoin FAQ on the Start9 support page says:

If you want to use bitcoin-cli, you may do so by adding an SSH key onto your Embassy and exec-ing into the bitcoind docker container.

I added an SSH key and can connect via SSH, but I need help with the docker exec command. The link only gives general info about docker and the rationale for it. Taking an educated guess based on docker documentation, I tried the following but got a permission error:

start9@embassy-xxxxxxx:~ $ docker exec bitcoind bitcoin-cli getblockcount
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/bitcoind/json": dial unix /var/run/docker.sock: connect: permission denied

(I know that the block height is available as a property of Bitcoin Core in the web UI. I only used it to test a basic command.)

I also got a permission error trying to list all docker containers (docker ps -a). I’d appreciate any help with this, thanks.

Nevermind, I found the answer with a bit more looking around on the Support page in the developer docs:

https://docs.start9.com/latest/developer-docs/advanced/dev-tools/service-container

I recommend that the link in the Bitcoin FAQ point here instead.

Hey there,

Sorry for the slow reply. The problem here is that you are not using sudo (or logging in as root) before issuing your docker commands as stated in the sentence immediately before the code snippet. I can change the docs to make the code snippet use sudo.