Software⏱️ 3 min read📅 2026-06-11

How to Fix: GPG Error on APT-GET docker container (Ubuntu 22.04)

GPG Error on APT-GET docker container (Ubuntu 22.04) - resolve issue with insecure repositories.

Quick Answer: Check the GPG keys for the repository and update them to resolve the error.

The GPG error on APT-GET docker container in Ubuntu 22.04 occurs when the system is unable to verify the authenticity of packages due to a missing or corrupted public key. This issue affects users who are using the `ubuntu:22.04` docker image and attempt to run `apt-get update` commands within the container.

This error can be frustrating as it prevents the system from updating its package list, leading to potential security vulnerabilities and compatibility issues.

🛑 Root Causes of the Error

  • The primary reason for this error is that the GPG key for the Ubuntu repository is not enabled by default in the docker image. This is a known issue with the `ubuntu:22.04` image, where the GPG key is not included in the default configuration.
  • Another possible cause could be that the public key is not properly configured or installed on the system, which would prevent APT-GET from verifying the authenticity of packages.

✅ Best Solutions to Fix It

Enabling GPG Key for APT-GET

  1. Step 1: Run the following command to add the Ubuntu GPG key: `sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ` Replace `` with the actual key ID.
  2. Step 2: Add the following line to the `/etc/apt/sources.list.d/ubuntu_list` file to enable the repository: `deb [arch=amd64,security=trusted] http://archive.ubuntu.com/ubuntu jammy-security main restricted`
  3. Step 3: Run `sudo apt update` to verify that the package list has been updated successfully.

Using a Different Docker Image with GPG Key Enabled

  1. Step 1: Use a different Ubuntu image that includes the GPG key, such as `ubuntu:22.04-bionic` or `ubuntu:22.04-focal`. This may require updating the Jenkins pipeline to use the new image.
  2. Step 2: Verify that the package list has been updated successfully using `sudo apt update`.

💡 Conclusion

To resolve the GPG error on APT-GET docker container in Ubuntu 22.04, you can either enable the GPG key for APT-GET by following the steps outlined above or use a different Docker image that includes the GPG key enabled. By taking these steps, you should be able to update your package list and ensure the security and compatibility of your system.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions