Hi,
I'm not sure if it's something that I'm doing, but I'm having issues using gpg with specifically the python:alpine image. I've verified it works using the python:3 image. This is the error I get:
/bin/sh: gpg: not found
The command '/bin/sh -c gpg --import my_key.asc' returned a non-zero code: 127
Anyone else having issues import gpg keys on the alpine image, or if you know what I'm doing wrong, please do let me know.
The Alpine variant doesn't include gpg
https://github.com/docker-library/docs/tree/master/python#pythonalpine
To minimize image size, it's uncommon for additional related tools (such as
gitorbash) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see thealpineimage description for examples of how to install packages if you are unfamiliar).
Thanks @wglambert. So I tried to install gpg using the following command:
apk add --update gpg
ERROR: unsatisfiable constraints:
gpg (missing):
required by: world[gpg]
Also, how come gpg is used when building the alpine image here: https://github.com/docker-library/python/blob/0c0365d804c2ef4ee8edef652e6a39cdf461e3b2/3.7/alpine3.8/Dockerfile#L32
It's gnupg in the repos
FROM python:alpine
RUN apk add --no-cache gnupg
$ docker build . -t python:test
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM python:alpine
---> d30308ec4dc1
Step 2/2 : RUN apk add --no-cache gnupg
---> Running in 54b67275c380
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
(1/17) Installing libgpg-error (1.30-r0)
(2/17) Installing libassuan (2.5.1-r0)
(3/17) Installing libcap (2.25-r1)
(4/17) Installing pinentry (1.1.0-r0)
Executing pinentry-1.1.0-r0.post-install
(5/17) Installing libgcrypt (1.8.3-r0)
(6/17) Installing gmp (6.1.2-r1)
(7/17) Installing nettle (3.4-r1)
(8/17) Installing p11-kit (0.23.10-r0)
(9/17) Installing libtasn1 (4.13-r0)
(10/17) Installing libunistring (0.9.7-r0)
(11/17) Installing gnutls (3.6.2-r0)
(12/17) Installing libksba (1.3.5-r0)
(13/17) Installing db (5.3.28-r0)
(14/17) Installing libsasl (2.1.26-r13)
(15/17) Installing libldap (2.4.46-r0)
(16/17) Installing npth (1.5-r1)
(17/17) Installing gnupg (2.2.8-r0)
Executing busybox-1.28.4-r1.trigger
OK: 29 MiB in 51 packages
Removing intermediate container 54b67275c380
---> 60ba740b5dec
Successfully built 60ba740b5dec
Successfully tagged python:test
$ docker run -it --rm python:test which gpg
/usr/bin/gpg
Awesome! Thank you @wglambert for the help.
Most helpful comment
It's
gnupgin the repos