问题
I'm trying to build a custom docker image for running some python code in ubuntu. The Dockerfile is as follows:
FROM ubuntu:latest
LABEL maintainer="NONE"
LABEL version="0.1"
LABEL description="This is custom Docker Image for "
ARG DEBIAN_FRONTEND=noninteractive
ARG --security-opt seccomp:unconfined
RUN apt-get update
RUN apt-get install software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update
RUN apt-get install python3.8
RUN mkdir file
When I try to build the image with the following command
$ docker build -t pythontest:0.1 .
It comes up with the error
Sending build context to Docker daemon 3.072kB
Step 1/12 : FROM ubuntu:latest
---> 3324772e8bdf
Step 2/12 : LABEL maintainer="NONE"
---> Using cache
---> f01ea4479da0
Step 3/12 : LABEL version="0.1"
---> Using cache
---> c47bd2e4db51
Step 4/12 : LABEL description="This is custom Docker Image for "
---> Using cache
---> 4d4e2eacd32d
Step 5/12 : ARG DEBIAN_FRONTEND=noninteractive
---> Using cache
---> fd189bb79348
Step 6/12 : ARG --security-opt seccomp:unconfined
---> Using cache
---> fcf86c83bf36
Step 7/12 : RUN apt-get update
---> Running in 3e6bc0a2f06a
Get:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease [265 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [111 kB]
Err:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease
At least one invalid signature was encountered.
Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [98.3 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [107 kB]
Err:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
At least one invalid signature was encountered.
Err:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
At least one invalid signature was encountered.
Err:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
At least one invalid signature was encountered.
Reading package lists...
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-security InRelease' is not signed.
The command '/bin/sh -c apt-get update' returned a non-zero code: 100
I've tried to do --security-opt seccomp:unconfined
which I found on the internet, but it still doesn't work.
What can I do to fix it? Thank you, I am new to containers, if I do anything wrong I'd like to apologize for it.
The docker version that I'm using is 19.03.8, running on raspberry pi 4. OS: Ubuntu Server 20.04
Here is output of docker image inspect ubuntu:latest
{
"Id": "sha256:3324772e8bdf660aaf741dbcac501848ddcabfe01959f3ca8c86a2a009208bea",
"RepoTags": [
"ubuntu:latest"
],
"RepoDigests": [
"ubuntu@sha256:fff16eea1a8ae92867721d90c59a75652ea66d29c05294e6e2f898704bdb8cf1"
],
"Parent": "",
"Comment": "",
"Created": "2020-10-23T18:16:30.775377487Z",
"Container": "daa39024d37233b858422faf1f61c075e22042f4b509a2167365c47a228eac7d",
"ContainerConfig": {
"Hostname": "daa39024d372",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"CMD [\"/bin/bash\"]"
],
"Image": "sha256:68f8e17ca86b7256cc7d0e8837153fc04aef3c773759b39fc85e8acea31cef03",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"DockerVersion": "19.03.12",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/bash"
],
"Image": "sha256:68f8e17ca86b7256cc7d0e8837153fc04aef3c773759b39fc85e8acea31cef03",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": null
},
"Architecture": "arm",
"Os": "linux",
"Size": 49750525,
"VirtualSize": 49750525,
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/7a6c15236a35169104ea390778d70897604471cb88fe388d426e9feac647bef7/diff:/var/lib/docker/overlay2/6316859fe20573107ba86c5754b2ad30046257c9917e50a13a4ffa63ff0a789d/diff",
"MergedDir": "/var/lib/docker/overlay2/22d5e265d242fa8cf87fd5c4075958ab144dbf0712717b36fc8af41cb554a7bd/merged",
"UpperDir": "/var/lib/docker/overlay2/22d5e265d242fa8cf87fd5c4075958ab144dbf0712717b36fc8af41cb554a7bd/diff",
"WorkDir": "/var/lib/docker/overlay2/22d5e265d242fa8cf87fd5c4075958ab144dbf0712717b36fc8af41cb554a7bd/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:1891915f38b4349f99946b899c416ff2e360ff1057fb662d6ae94a9ec7ab04f0",
"sha256:7d1044b9450b57d7507221479ccd4607d86cb6e73a2fa20b6399642a807ff192",
"sha256:8ec53037c94bd75359fbb42036fa28aeda1e6b11725a0ad46f0ded867b40e227"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]
回答1:
Prune the unused images to free up space. Maybe the Docker images on your OS had run out of disk space. That somehow exposed itself as apt
reporting invalid signatures on package index files.
docker image prune -a
来源:https://stackoverflow.com/questions/64841660/error-about-apt-get-update-when-building-a-docker-image