How to resolve `The following signatures couldn't be verified because the public key is not available` when building a docker image

Overview

When building a Docker image based on Ubuntu 22.04, you may run into errors such as the following when calling apt-get:

The following signatures couldn't be verified because the public key is not available: NO_PUBKEY

This can happen when the image used for your machine executor or remote docker build is older. 

Machine Executor

For machine executor builds, please try setting one of our updated 20.04 or 22.04 Ubuntu images. 

Here is an example using the image ubuntu-2004:current:

version: 2.1
jobs:
  build:
    machine:
      image: ubuntu-2004:current

For a list of other image tags, please reference the following page:

https://circleci.com/developer/machine/image/ubuntu-2004

Remote Docker

For users building images with setup_remote_docker enabled, please try setting a recent version of the Docker engine. This will use an updated image when the vm is launched.

To set a version of Docker to be used, please follow this syntax:

- setup_remote_docker:
    version: 20.10.14

Additional versions are available on the following page in our documentation:

https://circleci.com/docs/2.0/building-docker-images/#docker-version

 

Additional Resources:

Was this article helpful?
1 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.