Error installing public keys in docker container without gnupg, but can’t install gnupg without keys

I’m having to upgrade a docker container from a node:16-slim to a node:18-slim base. I’ve been having issues so have cut the dockerfile back to absolute basics, but still can’t get it to work when running through my gitlab pipeline.

This is the first (incredibly brief) dockerfile:

FROM node:18-slim

RUN apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys 0E98404D386FA1D9 && 
    apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys 6ED0E7B82643E131 && 
    apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys F8D2585B8783D481 && 
    apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys 54404762BBB6E853 && 
    apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys BDE6D2B9216EC7A8

This gives me the error “gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation”, so I try to add gnupg2 (I’ve also tried gnupg and gnupg1, out of interest, same issue):

FROM node:18-slim

RUN apt-get update && apt-get install -y gnupg2

RUN apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys 0E98404D386FA1D9 && 
    apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys 6ED0E7B82643E131 && 
    apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys F8D2585B8783D481 && 
    apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys 54404762BBB6E853 && 
    apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys BDE6D2B9216EC7A8

And now I get the issue that prompted me to add the keys in the first place:

> [2/3] RUN apt-get update && apt-get install -y gnupg2:
0.375   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 54404762BBB6E853 NO_PUBKEY BDE6D2B9216EC7A8
0.377 Reading package lists...
0.385 W: GPG error: http://deb.debian.org/debian bookworm InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0E98404D386FA1D9 NO_PUBKEY 6ED0E7B82643E131 NO_PUBKEY F8D2585B8783D481
0.385 E: The repository 'http://deb.debian.org/debian bookworm InRelease' is not signed.
0.385 W: GPG error: http://deb.debian.org/debian bookworm-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0E98404D386FA1D9 NO_PUBKEY 6ED0E7B82643E131
0.385 E: The repository 'http://deb.debian.org/debian bookworm-updates InRelease' is not signed.
0.385 W: GPG error: http://deb.debian.org/debian-security bookworm-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 54404762BBB6E853 NO_PUBKEY BDE6D2B9216EC7A8
0.385 E: The repository 'http://deb.debian.org/debian-security bookworm-security InRelease' is not signed.
0.385 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'
0.386 E: Sub-process returned an error code

So it seems I need the public keys to do an apt-get update, but I need gnupg for that, and to install that, I need to do apt-get update. This is all feeling very circular.

Can anyone offer some insight? Thanks!

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật