# Occur GPG error .... NO\_PUBKEY 871920D1991BC93C in docker build

**URL:** <https://travis-ci.community/t/occur-gpg-error-no-pubkey-871920d1991bc93c-in-docker-build/14540>\
**Category:** Travis CI Discussions & Feedback\
**Tags:** travis-build, docker\
**Created:** [February 12, 2025, 9:16am UTC](https://travis-ci.community/t/occur-gpg-error-no-pubkey-871920d1991bc93c-in-docker-build/14540 "2025-02-12T09:16:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chiyiliao](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/chiyiliao/32/9431_2.png) [@chiyiliao](https://travis-ci.community/u/chiyiliao)\
**Post date:** [February 12, 2025, 9:16am UTC](https://travis-ci.community/t/occur-gpg-error-no-pubkey-871920d1991bc93c-in-docker-build/14540/1 "2025-02-12T09:16:21Z")

</div>

Hi,  
When build Dockefile in travis, occur below errors:

```auto
W: GPG error: http://ports.ubuntu.com/ubuntu-ports noble InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
E: The repository 'http://ports.ubuntu.com/ubuntu-ports noble InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
E: The repository 'http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
E: The repository 'http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports noble-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
E: The repository 'http://ports.ubuntu.com/ubuntu-ports noble-security InRelease' is not signed.
E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true'
E: Sub-process returned an error code

```

But I build the same Dockefile in local is successful.

My .travis.yml as below:

```auto

arch: arm64-graviton2
virt: vm
os: linux
group: edge
language: python

dist: focal
sudo: required

python:
  - 3.8
cache: pip
services:
  - docker
.
.
.

```

Dockerfile as below:

```auto
FROM --platform=linux/arm64 ubuntu:noble
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
       apt-get install -y --no-install-recommends procps apt-utils locales curl default-jre
.
.
.

```

Does anyone know why this happened?

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [February 12, 2025, 7:50pm UTC](https://travis-ci.community/t/occur-gpg-error-no-pubkey-871920d1991bc93c-in-docker-build/14540/2 "2025-02-12T19:50:27Z")

</div>

You need to retrieve the GPG key:

```sh
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C

```

So something like:

```yml
arch: arm64-graviton2
virt: vm
os: linux
group: edge
language: python

dist: focal
sudo: required

python:
  - 3.8
cache: pip
services:
  - docker

before_install:
  - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C || 
    (sudo mkdir -p /etc/apt/keyrings && 
     sudo curl -fsSL https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x871920D1991BC93C | sudo tee /etc/apt/keyrings/noble.gpg > /dev/null &&
     sudo chmod 644 /etc/apt/keyrings/noble.gpg)
  - sudo apt update

```

Should do it.

---

<div class="post-metadata">

**Author:** ![chiyiliao](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/chiyiliao/32/9431_2.png) [@chiyiliao](https://travis-ci.community/u/chiyiliao)\
**Post date:** [February 19, 2025, 6:30am UTC](https://travis-ci.community/t/occur-gpg-error-no-pubkey-871920d1991bc93c-in-docker-build/14540/3 "2025-02-19T06:30:41Z")

</div>

Hi Montana,

Since my base docker image is ubuntu:noble , there are no GPG related components by default, so when run “apt-key adv --keyserver [keyserver.ubuntu.com](http://keyserver.ubuntu.com) --recv-keys …” command, it will reply that there is no GPG related tools.

It seems to only happen with arm64, not amd64.

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [February 24, 2025, 6:23pm UTC](https://travis-ci.community/t/occur-gpg-error-no-pubkey-871920d1991bc93c-in-docker-build/14540/4 "2025-02-24T18:23:04Z")

</div>

Hi @chiyiliao,

```Dockerfile
FROM ubuntu:noble
RUN apt-get update && apt-get install -y --no-install-recommends \
    gnupg \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*

RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C

RUN apt-get update && apt-get install -y \
    <your-packages-here> \
    && rm -rf /var/lib/apt/lists/*

```

Try this as your `Dockerfile`, please replace proper packages, etc.
