Repository is not signed in docker build

倖福魔咒の 提交于 2020-07-31 19:33:54

问题


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


回答1:


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




回答2:


fixed by

docker image prune -f

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




回答3:


Running command below fixed problem for me:

docker system prune --force

The --force flag stands for non interactive prune.




回答4:


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://stackoverflow.com/a/62088961/7387935

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 peissions were correct.




回答5:


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.



来源:https://stackoverflow.com/questions/59139453/repository-is-not-signed-in-docker-build

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!