Score:0

Access Debian repo in Docker build: `The following signatures couldn't be verified because the public key is not available`

us flag

When I try to build the following Dockerfile

FROM debian:bullseye

RUN set -eux; \
    apt update; \
    apt install -y --no-install-recommends ca-certificates;

RUN set -eux; \
    echo "deb https://nginx.org/packages/mainline/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list;

RUN set -eux; \
    apt update;

I get the error:

#0 1.077 Err:4 https://nginx.org/packages/mainline/debian bullseye InRelease
#0 1.077   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ABF5BD827BD9BF62
#0 1.082 Reading package lists...
#0 1.348 W: GPG error: https://nginx.org/packages/mainline/debian bullseye InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ABF5BD827BD9BF62
#0 1.348 E: The repository 'https://nginx.org/packages/mainline/debian bullseye InRelease' is not signed.

Is there a reasonably simple way to get access to the nginx package repository in a Docker build?

Score:1
pt flag

Configure the nginx repository as a "trusted" repository:

FROM debian:bullseye

RUN set -eux; \
    apt update; \
    apt install -y --no-install-recommends ca-certificates;

RUN set -eux; \
    echo "deb [trusted=yes] https://nginx.org/packages/mainline/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list;

RUN set -eux; \
    apt update;

Configuring a repository as "trusted" means that GPG checks are not required.

clay avatar
us flag
wow, thank you so much! That works!! The other answers I found via searches were very complicated.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.