Manu Chadha
Manu Chadha

Reputation: 16723

apt and apt-get in Dockerfile returning error

I am trying to create a Docker image of Cassandra. Cassandra requires Java. I have added line to install java. In my Docker file

FROM ubuntu:20.04
RUN apt-get update
RUN apt-get install default-jre
COPY apache-cassandra-3.11.6-bin.tar.gz .
RUN tar -xzf apache-cassandra-3.11.6-bin.tar.gz 
RUN chmod -R 777 apache-cassandra-3.11.6
RUN ls
RUN echo $PATH
RUN echo $PWD
RUN apt update

#RUN apt-get install openjdk-7-jdk
#RUN java -version
WORKDIR apache-cassandra-3.11.6
RUN ls
ENV CASSANDRA_HOME=/apache-cassandra-3.11.6
ENV PATH=$PATH:$CASSANDRA_HOME/bin
RUN echo $PATH
RUN ls
WORKDIR apache-cassandra-3.11.6/bin
RUN ls
CMD ["cassandra","-f"]

I am getting error in apt-get update and apt. How can I fix this?

C:\Users\manuc\Documents\manu\cassandra_image_test>docker build -f CassandraImageDockerFile.txt -t manucassandra .
Sending build context to Docker daemon  184.8MB
Step 1/19 : FROM ubuntu:20.04
 ---> 74435f89ab78
Step 2/19 : RUN apt-get update
 ---> Running in b395852c8e6b
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [107 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Reading package lists...
E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease is not valid yet (invalid for another 1d 13h 27min 45s). Updates for this repository will not be applied.
E: Release file for http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease is not valid yet (invalid for another 1d 12h 39min 24s). Updates for this repository will not be applied.
E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease is not valid yet (invalid for another 1d 12h 39min 54s). Updates for this repository will not be applied.
The command '/bin/sh -c apt-get update' returned a non-zero code: 100

Upvotes: 1

Views: 2494

Answers (2)

Rajdeep Roy Chowdhury
Rajdeep Roy Chowdhury

Reputation: 143

Docker Desktop:
You can manually restart it using UI.

Docker machine:

$ docker-machine restart <DOCKER-MACHINE-NAME>

Podman:

$ podman restart <PODMAN-MACHINE-NAME>

Upvotes: 1

distro
distro

Reputation: 712

This seems to be an issue with your timezone. Please restart your Docker host.

Upvotes: 1

Related Questions