ruimarinho / docker-bitcoin-core

A bitcoin-core docker image
https://hub.docker.com/r/ruimarinho/bitcoin-core/
MIT License
370 stars 208 forks source link

Bug in GPG: argument --batch needed to build Dockerfile #68

Closed Stadicus closed 5 years ago

Stadicus commented 5 years ago

There's currently a bug in GPG that breaks the Docker build process of your Dockerfiles. GPG encounters an error if there is no TTY present (such as during the docker build) and exits with error code 2.

The bug seems to be a non-trivial one, see the following acknoledgement: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=913614#27

From the comment, there's this paragraph, which also provides the solution: by using the argument --batch GPG assumes a non-interactive environment and gets the keys without issues.

PS i do encourage everyone who is automating the use of gpg to use --batch everywhere, as this forces GnuPG into a mode that is expected to be used for automation (its "API", for lack of a better term, as opposed to its "UI", which is its normal non-batch mode). And, FWIW, i agree with Tianon that GnuPG should simply assume --batch if no tty exists, but that's not the kind of change i can fit into debian stable, i think.

I just added the --batch argument on the latest Dockerfile (v0.17.0), but it may be worthwile to extend this to other versions as well.

Stadicus commented 5 years ago

Additional remark: I also had to add an additional keyserver, as all of the existing ones did not respond in time. But that's probably a temporary issue, or a problem on my end, so I did not want to include that in this pull request.

gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"
Stadicus commented 5 years ago

As all checks failed due to unresponsive key servers, I added the keyserver.ubuntu.com anyway, just to see if that solves the issue.

bugrasan commented 5 years ago

i did not have this issue on ubuntu 18.04. in case you go with --batch flag you missed one place on line 27 (new file): && gpg --verify /usr/local/bin/gosu.asc \ should be && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \

Stadicus commented 5 years ago

Strangely, the one --batch you point out does not work. I had it in the first commit but removed it (see second commit "remove --batch for verification").

I had the on an Odroid HC1 with Ubuntu 18.0.4 LTS. I will double check and give an update.

ruimarinho commented 5 years ago

GPG and the key server ecosystem has always been extremely unreliable to me. This does indeed seem to approve the responsiveness of the build. Thanks!

ruimarinho commented 5 years ago

Applied to all images, removed gosu manual download (now in Debian repos) and merged https://github.com/ruimarinho/docker-bitcoin-core/commit/b92bb28bc52af6fcc86e14b23abe7f7c862ae682. Thanks!