apt-get update fails inside Dockerfile

  apt-get, docker, linux, ubuntu

When I try to build a simple docker image:

in Dockerfile:

FROM ubuntu:18.04

RUN apt-get update

The output is:

$ sudo docker build --no-cache -t testbuild .
Sending build context to Docker daemon  3.471MB
Step 1/2 : FROM ubuntu:18.04
 ---> c090eaba6b94
Step 2/2 : RUN apt-get update
 ---> Running in 53d64603442f
Ign:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Ign:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Ign:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Err:4 http://security.ubuntu.com/ubuntu bionic-security Release
  404  Not Found [IP: 91.189.88.142 80]
Ign:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Err:6 http://archive.ubuntu.com/ubuntu bionic Release
  404  Not Found [IP: 91.189.88.152 80]
Err:7 http://archive.ubuntu.com/ubuntu bionic-updates Release
  404  Not Found [IP: 91.189.88.152 80]
Err:8 http://archive.ubuntu.com/ubuntu bionic-backports Release
  404  Not Found [IP: 91.189.88.152 80]
Reading package lists...
E: The repository 'http://security.ubuntu.com/ubuntu bionic-security Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-updates Release' does not have a Release file.
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-backports Release' does not have a Release file.
The command '/bin/sh -c apt-get update' returned a non-zero code: 100

I tried:

  1. build with different types of ubuntu images – e.g. ubuntu:16.04, 18.04,20.04 – and get a similar error ‘…Release’ does not have a Release file.’

  2. I completely removed and reinstalled docker from my system, inc all containers and repository, and rebooted, and get the same error

I previously built multiple docker images and everything worked fine. And now I get this error out of nowhere all the time.

Source: Docker Questions

LEAVE A COMMENT