Repository is not signed in docker build
Asked Answered
D

16

219

I have the following Dockerfile that uses the latest Ubuntu image pulled from dockerhub:

FROM ubuntu:latest  
RUN apt-get update  && apt-get install -y  g++ llvm lcov 

when I launch the docker build command, the following errors occur:

Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease 
At least one invalid signature was encountered.

Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
  At least one invalid signature was encountered.

Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  At least one invalid signature was encountered.

Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  At least one invalid signature was encountered.

Reading package lists...

W: GPG error: http://archive.ubuntu.com/ubuntu bionic InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic InRelease' is not signed.

W: GPG error: http://security.ubuntu.com/ubuntu bionic-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://security.ubuntu.com/ubuntu bionic-security InRelease' is not signed.

W: GPG error: http://archive.ubuntu.com/ubuntu bionic-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-updates InRelease' is not signed.

W: GPG error: http://archive.ubuntu.com/ubuntu bionic-backports InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-backports InRelease' is not signed.

I read here https://superuser.com/questions/1331936/how-can-i-get-past-a-repository-is-not-signed-message-when-attempting-to-upgr that you can pass this error using --allow-unauthenitcated or --allow-insecure-repositories but both seem to me workarounds that may compromize security of the container.

EDIT

Tried to pull ubuntu:18.04, ubuntu:19:04, ubuntu:19.10 same error with different distro name

Desex answered 2/12, 2019 at 13:0 Comment(7)
Are you working behind a proxy?Duncandunce
@Duncandunce No, not at allDesex
Other than latest did you try ubuntu:18.04?Latinity
yes, I tried 19.04, 19.10Desex
I tried to pull a newer image and it worked for me. Looks like some bug in the imageMattock
I am encountering this error on Mac but increasing disk space, docker image prune -a, etc., do not work. Interestingly, apt-get update works if I run docker run -it --privileged ubuntu:24.04 but fails without --privileged.Advantage
Manually updating Docker Desktop for Mac to the latest version fixed it for me.Advantage
D
401

Apparently my root partition was full (maybe I've tried too many times to download packages through apt), and running sudo apt clean solved the issue


In addition, the following commands should help clean up space:

docker system df # which can show disk usage and size of 'Build Cache'
docker image prune # add -f or --force to not prompt for confirmation
docker container prune # add -f or --force to not prompt for confirmation
Desex answered 2/12, 2019 at 14:40 Comment(16)
Using docker image prune and docker container prune resolved this for me.Geometric
docker image prune saved 52GB on my disk and made my build run again, thank you Antonio and Erik!Depth
can someone explain why this failure can happen? This challenges my understanding of docker: there seem to be state kept in between run that don't make the runs deterministic.Tristis
@David天宇Wong I believe it's a disk space issue, rather than old build/run state being reusedCalculate
I tried all of the above but my issue resolved after nuking the docker build cache. At first I looked at my docker usage by: docker system df. This told me that my build cache is 50+GB. Then I nuked it using docker builder prune.Osteitis
Amazing... it was the solution, I was staring at everything but didn't realize my root partition had run out of space.Ouzel
I had the same issue. I am running Docker Toolbox on VirtualBox on top of Windows 10 and the /var mount filled up: E: You don't have enough free space in /var/cache/apt/archives/Teasley
I came across this in a docker buildx build; docker buildx prune sorted things...Entreaty
For me, docker image prune was not helping and I discovered I had to use docker image prune -a. I reclaimed about 50GB and fixed my build!Capone
@Osteitis following this advice, I ran docker system df and realized I needed to run docker volume prune to resolve the issue.Kammerer
Doing docker system prune wasn't enough for me. I needed to delete images and run docker volume prune as well.Waligore
Running 'docker system prune' only reclaimed a couple of gigabytes (out of a couple of hundred), but seems to have solved the problem nevertheless. I have no idea why, no disks were anywhere close to full, AFICT. But thanks anyway, upvoted.Lions
Using docker image prune and docker container prune resolved this for me as well.Virility
Geez docker, can you give a better error message pls. Spend 1hr just to realise this is the root cause.Lavatory
docker buildx prune --all --force freed up a lot of space for meBrina
At least one invalid signature was encountered. is the very strange error message for the insufficient space issue! Surprisingly it resolves my problem.Oration
L
142

Since Docker API v1.25+ ( released: Nov 18, 2019 )

Running the command below fixed the problem for me:

docker system prune --force

The --force flag stands for noninteractive prune.

Additionally, you may want to give a try to the prune volume commands:

docker volume prune --force
Lind answered 19/6, 2020 at 14:48 Comment(5)
docker system prune wasn't enough for me. I also needed to delete images and run docker volume prune to resolve the issue.Waligore
thanks @JonasEicher, I've included your case into the answerLind
These can be combined into one: docker system prune --all --force --volumesHispania
Thanks for sharing @AndriyIvaneyko! It worked running docker system prune --forceBleat
@Bleat Absolutely, happy it was useful for you !Lind
M
62

fixed by

docker image prune -f

looks like docker has a limit on maximum apt cache size on the host system

Mackle answered 23/4, 2020 at 22:42 Comment(1)
I needed to run docker volume rm $(docker volume ls -q) as well.Positive
L
46

If you're using Docker Desktop, take care of the maximum disk image size you've specified in the settings. It can cause the issue if it gets full during the build (source).

enter image description here

Lanie answered 20/10, 2020 at 19:33 Comment(3)
Thank you--- both this (increasing disk image size resource) and pruning my system resolved this for me on Docker/Mac.Hards
Thanks! Worked for me. Weird that apt-get is not clearer about the issue.Argentum
Increasing disk image size helped me, thanks :)Percolation
S
31

For Raspbian, upgrade libseccomp manually on the host system by using:

curl http://ftp.us.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.1-1_armhf.deb --output libseccomp2_2.5.1-1_armhf.deb
sudo dpkg -i libseccomp2_2.5.1-1_armhf.deb

This resolved my issue.

Original post is here.

Slattern answered 15/2, 2021 at 21:12 Comment(2)
Yes, that was it! It seems to be only true for the armhf-Raspberry OS. Everything works on my 64bit servers.Quianaquibble
Solved for me too. Thanks.Subcontinent
T
16

As @Danila and @Andriy pointed out this issue can easily be fixed running:

docker image prune -f
docker container prune -f

but posting this answer, as running just one of them didn't work for me (on MacOS X) - running both however does.

Tomsk answered 3/10, 2020 at 15:2 Comment(0)
D
9

This helps me:

 docker volume prune
Dichy answered 1/10, 2021 at 13:40 Comment(0)
L
4

I had to run container with --security-opt seccomp:unconfined.

Lassiter answered 30/9, 2021 at 10:16 Comment(0)
A
3

I had this problem on one of my two machines. Doing a ls -ld /tmp I got

drwxrwxrwt 3 root root 4096 May 15 20:46 /tmp

for the working one and

drwxr-xr-t 1 root root 4096 May 26 05:44 /tmp

for the failing one. After I did chmod 1777 /tmp, it worked!!

EDIT:

So, I dived a little deeper into this problem and realized there was something fundamentally wrong. I put my problems in another question and later found the answer that solved this myself: https://mcmap.net/q/120668/-using-the-same-docker-image-file-permissions-differ-from-machine-to-machine

The key point here is that on the machine that was working correctly I had aufs as storage driver and on the faulty one it was overlay2. After I changed that, all permissions were correct.

Amaty answered 29/5, 2020 at 11:34 Comment(1)
this one worked for me. I had moved the tmp folder to another drive and placed a simlink in root folder. That started to create problems with signature and many other errors. I did as you explained here, but then I moved the tmp folder back to root directory and deleted the simlink. I might just leave the tmp folder where it should stay.Tedda
P
2

I tried again later and it worked.

From https://github.com/docker-library/php/issues/898#issuecomment-539234070:

That usually means the mirror is having issues (possibly partially out of date; i.e. not completely synced from other mirrors) and often clears itself up.

Positive answered 22/7, 2020 at 3:40 Comment(0)
M
1

this worked for me docker system prune -af --volumes and these other ones as well

docker image prune 
docker container prune
docker builder prune
docker volume prune

This running docker system df and see if you need free space on one of your volumes

Moriyama answered 5/5, 2022 at 19:49 Comment(0)
A
1

The existing answers all talk about creating more space for Docker by removing existing Docker items via docker container prune, docker image prune and docker volume prune. Alternatively it is also possible to increase the disk limit that Docker has set for it self (provided that you have enough disk space).

In Docker Desktop go to Settings > Resources and increase the "Virtual disk limit".

This has helped me since I work with several large docker images and don't want to bothered every time to prune.

Audieaudience answered 23/3, 2023 at 13:22 Comment(0)
V
0

I was able to resolve this issue by stopping all of my running containers (2, in my case).

Vice answered 23/2, 2023 at 23:4 Comment(0)
C
0

TLDR: try to uninstall ubuntu 22.04 from wsl and install Docker Desktop v4.23.0.

I now have two machines with this error on one of them. I've tried all of your suggestions with no luck. At some point I've noticed the only difference between software versions is version of ubuntu installed on wsl as default distro. So I uninstalled 22.04, installed 20.04 for clear test case and guess what? It works!

What a lovely day

Chapel answered 17/1, 2024 at 18:4 Comment(0)
M
0

I found the solution here, it's about permissions : https://superuser.com/questions/1496529/sudo-apt-get-update-couldnt-create-temporary-file

chmod 1777 /tmp
Mulberry answered 11/4, 2024 at 13:26 Comment(0)
T
-2

I added --network=host to the build command.

docker build --network=host -t REPOSITORY:TAG  ./
Tooley answered 9/3, 2022 at 22:56 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.