GnuPG IPC randomly failing

Currently having problems with builds randomly failing due to GPG IPC errors. Building locally works flawlessly.

Started happening between 2015-03-23 02:17:57 and 2015-04-08 20:17:16.

Repo: nfnty/arch-mini

Log:

Step 7 : RUN pacman-key --init && pacman-key --populate archlinux
e[91mgpg: /etc/pacman.d/gnupg/trustdb.gpg: trustdb created
e[0m
e[91mgpg: no ultimately trusted keys found
e[0m
e[91mgpg: starting migration from earlier GnuPG versions
e[0m
e[91mgpg: can’t connect to the agent: IPC connect call failed
e[0m
e[91mgpg: error: GnuPG agent unusable. Please check that a GnuPG agent can be started.
e[0m
e[91mgpg: migration aborted
e[0m
e[91mgpg: starting migration from earlier GnuPG versions
e[0m
e[91mgpg: porting secret keys from ‘/etc/pacman.d/gnupg/secring.gpg’ to gpg-agent
e[0m
e[91mgpg: migration succeeded
e[0m
e[91mgpg: Generating pacman keyring master key…
e[0m
e[91mgpg: checking created signature failed: No public key
e[0m
e[91mgpg: signing failed: No public key
e[0m
e[91mgpg: make_keysig_packet failed: No public key
e[0m
e[91mgpg: key generation failed: No public key
e[0m
e[91mgpg: Done
e[0m
==> Updating trust database…
e[91mgpg: no need for a trustdb check
e[0m
==> Appending keys from archlinux.gpg…
==> Locally signing trusted keys in keyring…
→ Locally signing key 0E8B644079F599DFC1DDC3973348882F6AC6A4C2…
e[91m==> ERROR: 0E8B644079F599DFC1DDC3973348882F6AC6A4C2 could not be locally signed.
e[0m
→ Locally signing key 684148BB25B49E986A4944C55184252D824B18E8…
e[91m==> ERROR: 684148BB25B49E986A4944C55184252D824B18E8 could not be locally signed.
e[0m
→ Locally signing key 44D4A033AC140143927397D47EFD567D4C7EA887…
e[91m==> ERROR: 44D4A033AC140143927397D47EFD567D4C7EA887 could not be locally signed.
e[0m
→ Locally signing key 27FFC4769E19F096D41D9265A04F9397CDFD6BB0…
e[91m==> ERROR: 27FFC4769E19F096D41D9265A04F9397CDFD6BB0 could not be locally signed.
e[0m
→ Locally signing key AB19265E5D7D20687D303246BA1DFB64FFF979E7…
e[91m==> ERROR: AB19265E5D7D20687D303246BA1DFB64FFF979E7 could not be locally signed.
e[0m

Any idea on what’s going on?

Log when build succeeds:

Step 7 : RUN pacman-key --init && pacman-key --populate archlinux
e[91mgpg: /etc/pacman.d/gnupg/trustdb.gpg: trustdb created
e[0m
e[91mgpg: no ultimately trusted keys found
e[0m
e[91mgpg: starting migration from earlier GnuPG versions
e[0m
e[91mgpg: porting secret keys from ‘/etc/pacman.d/gnupg/secring.gpg’ to gpg-agent
e[0m
e[91mgpg: migration succeeded
e[0m
e[91mgpg: Generating pacman keyring master key…
e[0m
e[91mgpg: key 9F6E6093 marked as ultimately trusted
e[0m
e[91mgpg: directory ‘/etc/pacman.d/gnupg/openpgp-revocs.d’ created
e[0m
e[91mgpg: Done
e[0m
==> Updating trust database…
e[91mgpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
e[0m
e[91mgpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
e[0m
==> Appending keys from archlinux.gpg…
e[91mgpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
e[0m
e[91mgpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
e[0m
==> Locally signing trusted keys in keyring…
→ Locally signing key 0E8B644079F599DFC1DDC3973348882F6AC6A4C2…
→ Locally signing key 684148BB25B49E986A4944C55184252D824B18E8…
→ Locally signing key 44D4A033AC140143927397D47EFD567D4C7EA887…
→ Locally signing key 27FFC4769E19F096D41D9265A04F9397CDFD6BB0…
→ Locally signing key AB19265E5D7D20687D303246BA1DFB64FFF979E7…
==> Importing owner trust values…
e[91mgpg: inserting ownertrust of 4
e[0m
e[91mgpg: setting ownertrust to 4
e[0m
e[91mgpg: setting ownertrust to 4
e[0m
e[91mgpg: setting ownertrust to 4
e[0m
e[91mgpg: setting ownertrust to 4
e[0m
==> Disabling revoked keys in keyring…
→ Disabling key F5A361A3A13554B85E57DDDAAF7EF7873CFD4BB6…
→ Disabling key 7FA647CD89891DEDC060287BB9113D1ED21E1A55…
→ Disabling key D4DE5ABDE2A7287644EAC7E36D1A9E70E19DAA50…
→ Disabling key BC1FBE4D2826A0B51E47ED62E2539214C6C11350…
→ Disabling key 9515D8A8EAB88E49BB65EDBCE6B456CAF15447D5…
→ Disabling key 4A8B17E20B88ACA61860009B5CED81B7C2E5C0D2…
→ Disabling key 63F395DE2D6398BBE458F281F2DBB4931985A992…
→ Disabling key 0B20CA1931F5DA3A70D0F8D2EA6836E1AB441196…
→ Disabling key 8F76BEEA0289F9E1D3E229C05F946DED983D4366…
→ Disabling key 66BD74A036D522F51DD70A3C7F2A16726521E06D…
→ Disabling key 81D7F8241DB38BC759C80FCE3A726C6170E80477…
→ Disabling key E7210A59715F6940CF9A4E36A001876699AD6E84…
==> Updating trust database…
e[91mgpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
e[0m
e[91mgpg: depth: 0 valid: 1 signed: 5 trust: 0-, 0q, 0n, 0m, 0f, 1u
e[0m
e[91mgpg: depth: 1 valid: 5 signed: 62 trust: 0-, 0q, 0n, 5m, 0f, 0u
e[0m
e[91mgpg: depth: 2 valid: 62 signed: 5 trust: 62-, 0q, 0n, 0m, 0f, 0u
e[0m
e[91mgpg: next trustdb check due at 2016-01-22
e[0m

Hey, I know it’s pretty late, but I had similar problem myself but managed to solve it by launching gpg-agent explicitly before performing any GPG operations:

RUN gpg-agent --daemon && ...