40

Getting error while building the following Docker file

FROM ubuntu:21.04

RUN apt-get update && \
    apt-get install --no-install-recommends -y curl=7.\* && \
    apt-get install --no-install-recommends -y unzip=6.\* &&\ 
    rm -rf /var/lib/apt/lists/*

RUN apt-get update && \
    mkdir -p /usr/share/man/man1 && \
    apt-get install --no-install-recommends -y maven=3.6.3-5 && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

The error occurs when the second apt-get update runs.

The error is as follows :-

E: The repository 'http://security.ubuntu.com/ubuntu hirsute-security InRelease' is not signed.
W: GPG error: http://archive.ubuntu.com/ubuntu hirsute InRelease: gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
E: The repository 'http://archive.ubuntu.com/ubuntu hirsute InRelease' is not signed.
W: GPG error: http://archive.ubuntu.com/ubuntu hirsute-updates InRelease: gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
E: The repository 'http://archive.ubuntu.com/ubuntu hirsute-updates InRelease' is not signed.
W: GPG error: http://archive.ubuntu.com/ubuntu hirsute-backports InRelease: gpgv, gpgv2 or gpgv1 required for verification, but neither seems installed
E: The repository 'http://archive.ubuntu.com/ubuntu hirsute-backports InRelease' is not signed.

Any kind of help would be appreciated.

2
  • 1
    Confirmed -- I get the same error with that dockerfile, so it's not specific to you. Commented Feb 22, 2021 at 20:39
  • I don't know if the bug is actually fixed. I had the same problem with a ubuntu 21.04 image downloaded a few weeks ago. Tonight I tried wiping to get the ubuntu image re-downloaded and the problem is gone. Commented Apr 18, 2021 at 20:56

8 Answers 8

23

That's a bug in the docker / seccomp / glibc interaction: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1916485

7
  • 5
    Fixed in with runc 1.0.0-rc93. You could find your version with docker version. Commented Apr 21, 2021 at 13:52
  • 3
    From the 21.04 release notes: “Due to changes in glibc 2.33 Ubuntu 21.04 container images require updated container runtimes. All widely used container runtimes shipped in supported versions of Ubuntu have been updated via the standard stable release updates procedure. Container hosts running other operating systems may need manual updates.”
    – andrewdotn
    Commented Apr 23, 2021 at 1:33
  • 1
    I found I had to completely uninstall docker and re-install to get this to work- following the instructions in askubuntu.com/questions/1230248/docker-problems-in-ubuntu-20-04 - when using ubuntu 20.04 as the host OS.
    – lewis
    Commented Apr 23, 2021 at 14:13
  • 1
    No way to use that fix on Dockerhub yet, right?
    – staticdev
    Commented Apr 27, 2021 at 12:54
  • Note: minikube still (as of v1.19.0) has runc 1.0.0-rc92 and is still effected by this issue (in my case I was using skaffold which does the build in minikube's docker).
    – sherbang
    Commented Apr 28, 2021 at 16:30
4

I've run your docker file and get the same error. Playing around with various ways to disable the verification also produced no good results. Neither did removing the version constraints and just installing the latest versions of the tools. The only solution I could find was to downgrade ubuntu to 20.04, but there is no 3.6.3-5 version of maven for that version of the OS, only 3.6.3-1 (afaik).

The closest I could get working is quite different from your desired image:

FROM ubuntu:20.04

RUN apt update && \
    apt install --no-install-recommends -y curl=7.\* unzip=6.\* maven=3.6.3-1 && \
    apt clean && \
    rm -rf /var/lib/apt/lists/* && \
    mkdir -p /usr/share/man/man1

Also note how I use apt rather than apt-get and I only do a single run (which makes a simpler image by having only a single layer) and only a single apt update and chain the things I want to install into a single apt install rather than separate ones. This is just quicker and easier.

However, if you want a maven build box, perhaps you'd be better advised using one of the prebuilt maven images from docker hub that are themselves based on openjdk images. For java the underlying linux distro rarely matters and the openjdk images are pretty well respected:

from maven:3.6.3-jdk-11
run apt update && apt install -y curl unzip && apt clean
2
  • 1
    Thanks, but the issue with Ubuntu 20.04 is that the security analysis fails for it. (i am using clair analysis for that). Right now the only solution was to use ubuntu version 20.10.
    – Tanmaya
    Commented Feb 23, 2021 at 3:40
  • The problem with using newer distros for your stated reason is that the vulns often haven't caught up yet, not that they don't exist. I think 20.10 was only released 4 months ago, so it's relatively untested, which could result in a false negative. Better sometimes to patch and justify - not all vulns are valid in a given context Commented Feb 23, 2021 at 3:47
4

This bug does not occur if using a newer version of Docker (tested with 20.10). If using an older version of Docker, I recommend switching to a previous version of the ubuntu image. I tested ubuntu:20.10 with Docker 19.03 and it worked just fine. This is discussed here: https://bugs.launchpad.net/cloud-images/+bug/1928218

4
  • 1
    thx, upgrading from Docker 19.03.5 to 20.10.6 fixed it for me =) Commented May 31, 2021 at 23:23
  • 1
    It does not fix the problem for me (on docker 20.10.0 build 7287ab3) on Macintosh. Commented Jul 21, 2021 at 12:19
  • Upgrading to 20.10.8 didn't fix my issue! Commented Sep 8, 2021 at 7:05
  • This worked for me.. Commented Jan 10, 2022 at 19:19
1

I had this problem while running apt in a chroot (sd card) where /dev/null was not present. Fixed up with bind mounts of /sys/ /proc/ /dev/ /dev/pts

systemd-nspawn was an easier solution, anyway

0

Update Docker version to the latest to solve this issue.

For ubuntu users follow these steps:

curl -fsSL https://get.docker.com -o get-docker.sh

sudo sh get-docker.sh

For others please refer this link: https://docs.docker.com/engine/install/

0

I was running to the same problem on Docker Desktop 4.26.1

I was able to solve by running docker system prune --force prior to running my build command.

-2

I ran into this problem when I was running the Ubuntu 21.04 image under Rootless Docker, but the apt-get update command worked fine under the system Docker (invoked via sudo). Since my need was just for a manual test of an environment setup script, I just ran under the system Docker but, depending on your application, that might not be secure.

-4

Substituting apt-get with apt has worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.