Atleast one invalid signature was encountered

36,853

Solution 1

There are a few reasons why you encounter these errors:

  1. There might be an issue with the existing cache and/or disc space. In order to fix it you need to clear the APT cache by executing: sudo apt-get clean and sudo apt-get update.

  2. The same goes with existing docker images. Execute: docker image prune -f and docker container prune -f in order to remove unused data and free disc space.

  3. If you don't care about the security risks, you can try to run the apt-get command with the --allow-unauthenticated or --allow-insecure-repositories flag. According to the docs:

Ignore if packages can't be authenticated and don't prompt about it. This can be useful while working with local repositories, but is a huge security risk if data authenticity isn't ensured in another way by the user itself.

Please let me know if that helped.

Solution 2

I had this same issue and none of the previous responses saying to prune images or containers worked. The reason was that my Docker Build Cache was taking up the bulk of the space. Running the below command fixed the issue:

docker system prune

You can then check to see if it worked by running:

docker system df

UPDATE:

The above command will clear the whole Docker system. If you want to clear only the build cache, you can do it with the below command (credit to saraf.gahl):

docker builder prune

Solution 3

The reason I usually see this is because docker has run out of disk space, which is frustrating because the error gives little indication that this is the problem. First try cleaning up images and containers you don't need using the prune command https://docs.docker.com/config/pruning/.

$ docker image prune 
$ docker container prune 

If you have a lot of images accumulated and want to remove all of them that aren't associated with an existing container try:

$ docker image prune -a 

Or you can remove only older images:

$ docker image prune -a --filter "until=24h"

Finally, on MacOS, where Docker runs inside a dedicated VM, you may need to increase the disk available to Docker from the Docker Desktop application (Settings -> Resources -> Advanced -> Disk image size).

Solution 4

@Jack Kawell got it right.

docker builder prune

This command does the trick. Beware of the command "docker system prune" as this would delete all your images (very destructive). The builder prune only deletes the build cache that is where your have all your previous (cached) builds steps.

Solution 5

I had the same problem. It looks like it was lack of space. I've removed old images and it started to work.

$ docker images

Select the ones you don't care anymore (to delete).

$ docker rmi <image_id>

Share:
36,853
Saranya Gupta
Author by

Saranya Gupta

Updated on December 22, 2021

Comments

  • Saranya Gupta
    Saranya Gupta over 2 years

    I am trying to build and deploy microservices images to a single-node Kubernetes cluster running on my development machine using minikube. I am using the cloud-native microservices demo application Online Boutique by Google to understand the use of technologies like Kubernetes, Istio etc.

    Link to github repo: microservices-demo

    While following the installation process, and on running command skaffold run to build and deploy my application, I get some errors:

    Step 10/11 : RUN apt-get -qq update     && apt-get install -y --no-install-recommends         curl
     ---> Running in 43d61232617c
    W: GPG error: http://deb.debian.org/debian buster InRelease: At least one invalid signature was encountered.
    E: The repository 'http://deb.debian.org/debian buster InRelease' is not signed.
    W: GPG error: http://deb.debian.org/debian buster-updates InRelease: At least one invalid signature was encountered.
    E: The repository 'http://deb.debian.org/debian buster-updates InRelease' is not signed.
    W: GPG error: http://security.debian.org/debian-security buster/updates InRelease: At least one invalid signature was encountered.
    E: The repository 'http://security.debian.org/debian-security buster/updates InRelease' is not signed.
    failed to build: couldn't build "loadgenerator": unable to stream build output: The command '/bin/sh -c apt-get -qq update     && apt-get install -y --no-install-recommends         curl' returned a non-zero code: 100
    

    I receive these errors when trying to build loadgenerator. How can I resolve this issue?

  • Saranya Gupta
    Saranya Gupta almost 4 years
    Hi, I have tried all the three methods, and it still does not work, is there anything else I could possibly do? Thanks!
  • Wytrzymały Wiktor
    Wytrzymały Wiktor almost 4 years
    @SaranyaGupta Have you tried that with sudo? Does it print the same error?
  • Saranya Gupta
    Saranya Gupta almost 4 years
    Yes! I have used sudo with all three methods.
  • Wytrzymały Wiktor
    Wytrzymały Wiktor almost 4 years
    If there are no space issues (check with df -h) there might be one more thing: run rm -rf /etc/apt/trusted.gpg.d/*. It will remove old gpg repositories that could potentially cause some conflicts.
  • Att Righ
    Att Righ over 3 years
    Caused by being out of diskspace (fixed by pruning with docker).
  • Igor Escobar
    Igor Escobar over 3 years
    docker-compose down -v --rmi all --remove-orphans did the trick for me.
  • Ilya Davydov
    Ilya Davydov over 3 years
    For me, docker image prune -f was enough !
  • Jay Douglass
    Jay Douglass about 3 years
    THIS. Omg how did you figure this out.
  • Juan Pedro Paredes
    Juan Pedro Paredes about 3 years
    Upgrading pi kernel to buster, upgrading to docker-ce and building my own image from debootstrap with qemu, see comment below.
  • saraf.gahl
    saraf.gahl about 3 years
    Thanks! This was a pointer in the right direction. Note you can also clear the build cache directly - docker builder prune. :)
  • Jack Kawell
    Jack Kawell about 3 years
    Added a note to this effect. Thanks!
  • soulmachine
    soulmachine over 2 years
    This works for me!
  • zyd
    zyd over 2 years
    docker builder prune worked perfectly for me
  • Michael
    Michael over 2 years
    Thank you so much! Same issue with e.g. balenalib/raspberry-pi-node. Using debian:buster, I can now build my Dockerfile without any errors.
  • Larry Cai
    Larry Cai over 2 years
    this works for me under minikube system
  • alex
    alex over 2 years
    docker system prune worked for me. Had 20 GB of build cache.
  • Dominik
    Dominik over 2 years
    Thanks, that fixed it for me. ( php:8.0-apache-bullseye container in a raspbian docker environment )
  • Noam Yizraeli
    Noam Yizraeli over 2 years
    thanks a lot! had the same issue trying to build a docker image for raspberry pi using a latest image for some tag that used bullseye as its base, switching to buster fixed the issue.
  • Tobias
    Tobias over 2 years
    Thanks a lot, that was the issue on my Raspberry Pi as well. Should have a lot more upvotes.
  • Wolfgang Stengel
    Wolfgang Stengel about 2 years
    But how to solve it?
  • rrlamichhane
    rrlamichhane about 2 years
    I had this issue on my mac while builder a docker image and I had no idea what was going on. This worked, thanks a lot!
  • duyn9uyen
    duyn9uyen almost 2 years
    I was getting this error in Azure Devops building by Docker image. Using --allow-unauthenticated with apt-get worked for me. Thanks!