Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Release file is not valid yet - Docker [closed]

Hi I am trying to build my docker container. But started getting these error

Sending build context to Docker daemon  26.09MB
Step 1/12 : FROM ubuntu:18.04
 ---> 6526a1858e5d
Step 2/12 : RUN apt-get update && apt-get -y upgrade     && apt-get -y install python3.8     && apt -y install python3-pip     && pip3 install --upgrade pip
 ---> Running in 7ee80131fc66
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
Reading package lists...
E: Release file for http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease is not valid yet (invalid for another 3d 11h 5min 46s). Updates for this 
repository will not be applied.
E: Release file for http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease is not valid yet (invalid for another 3d 12h 20min 40s). Updates for this repository will not be applied.
E: Release file for http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease is not valid yet (invalid for another 3d 10h 50min 56s). Updates for this repository will not be applied.
The command '/bin/sh -c apt-get update && apt-get -y upgrade     && apt-get -y install python3.8     && apt -y install python3-pip     && pip3 install --upgrade pip' returned a non-zero code: 100

Its strange because the I have build container before but never encountered the error. I saw online for answers they say adjust you system clock. I am using Windows laptop and I checked date-time is correct. Any idea what can cause this error ?

like image 849
Hitesh Somani Avatar asked Dec 13 '22 08:12

Hitesh Somani


1 Answers

I add this before apt-get update

# Workaround https://unix.stackexchange.com/questions/2544/how-to-work-around-release-file-expired-problem-on-a-local-mirror

RUN echo "Acquire::Check-Valid-Until \"false\";\nAcquire::Check-Date \"false\";" | cat > /etc/apt/apt.conf.d/10no--check-valid-until
like image 56
Jak Avatar answered Dec 15 '22 20:12

Jak