Forward gpg-agent to container

Benjamin Kircher benjamin.kircher at gmail.com
Sun Jun 10 18:05:55 CEST 2018



> On 6. Jun 2018, at 02:27, Phil Pennock <gnupg-users at spodhuis.org> wrote:
> 
> On 2018-06-05 at 17:17 -0400, Phil Pennock wrote:
>> Shell 2:
>> $ docker run -it --rm -v /var/run/pdp.gnupg:/root/.gnupg/S.gpg-agent.ssh alpine
>> / # chmod 0700 /root/.gnupg && chown root:root /root/.gnupg/S.gpg-agent
>> / # apk update && apk add --no-cache gnupg
> 
> I apologise, I missed fixing one glitch in review before sending.
> 
> The correct command to invoke Docker here is:
> 
>  docker run -it --rm -v /var/run/pdp.gnupg:/root/.gnupg/S.gpg-agent alpine
> 
> Don't use the `.ssh` name, that speaks an entirely different protocol
> and was a mental glitch when I first wrote the above, fixed in testing
> but not repaired in the email.
> 
> The command-line if you're running on Linux should thus be (untested):
> 
>  docker run -it --rm -v $HOME/.gnupg/S.gpg-agent.extra:/root/.gnupg/S.gpg-agent alpine
> 
> Adjust as appropriate for other images.

This gives me

  gpg: can't connect to the agent: IPC connect call failed

from within the container.

Command lines that led to this output are:

  $ docker run --volume $(gpgconf --list-dirs agent-extra-socket):/root/.gnupg/S.gpg-agent --entrypoint=sh -ti --rm fedora:latest

And the inside the container:

  # chmod 700 ~/.gnupg
  # gpg2 --keyserver pgp.uni-mainz.de --recv-keys <key-id>
  # gpg2 --list-secret-keys

BK


More information about the Gnupg-users mailing list