error building docker image 'executor failed running [/bin/sh -c apt-get -y update]'

Question:

I’m trying to build a docker image but it throws an error and I can’t seem to figure out why.

It is stuck at RUN apt-get -y update with the following error messages:

4.436 E: Release file for http://security.debian.org/debian-security/dists/buster/updates/InRelease is not valid yet (invalid for another 2d 16h 26min 22s). Updates for this repository will not be applied.

4.436 E: Release file for http://deb.debian.org/debian/dists/buster-updates/InRelease is not valid yet (invalid for another 3d 10h 28min 24s). Updates for this repository will not be applied.

executor failed running [/bin/sh -c apt-get -y update]: exit code: 100

Here’s my docker file:

FROM python:3.7

# Adding trusting keys to apt for repositories
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
# Adding Google Chrome to the repositories
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
# Updating apt to see and install Google Chrome
RUN apt-get -y update
# Magic happens
RUN apt-get install -y google-chrome-stable

# Installing Unzip
RUN apt-get install -yqq unzip
# Download the Chrome Driver
RUN CHROMEDRIVER_RELEASE=$(curl http://chromedriver.storage.googleapis.com/LATEST_RELEASE) && 
    echo "Chromedriver latest version: $CHROMEDRIVER_RELEASE" && 
    wget --quiet "http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_RELEASE/chromedriver_linux64.zip" && 
    unzip chromedriver_linux64.zip && 
    rm -rf chromedriver_linux64.zip && 
    mv chromedriver /usr/local/bin/chromedriver && 
    chmod +x /usr/local/bin/chromedriver && 
    chromedriver --version
# Set display port as an environment variable
ENV DISPLAY=:99

WORKDIR /

COPY requirements.txt ./

RUN pip install --upgrade pip && pip install -r requirements.txt

COPY . .

RUN pip install -e .

What is happening here?

Asked By: borisvanax

||

Answers:

It’s answered here https://askubuntu.com/questions/1059217/getting-release-is-not-valid-yet-while-updating-ubuntu-docker-container

Correct your system clock. (in comments I also suggested checking for a mismatch between clock and your timezone too)

Answered By: Tuan Anh Tran

If you are using docker desktop, please check if enough resources are set in settings/preferences.
Eg. memory and disk requirement

Answered By: nitin angadi

This happens specific to OS also.

I had same issues running MariaDB on my Windows 10.

Check for Docker Settings:

{
  "registry-mirrors": [],
  "insecure-registries": [],
  "debug": false,
  "experimental": false,
  "features": {
    "buildkit": true
  },
  "builder": {
    "gc": {
      "enabled": true,
      "defaultKeepStorage": "20GB"
    }
  }
}

Remove below block, and it should work:

"features": {
    "buildkit": true
  },
Answered By: Sourabh Lalwani

In my case, docker was still using the cached RUN apt update && apt upgrade command, thus not updating the package sources.

The solution was to build the docker image once with the --no-cache flag:

docker build --no-cache .
Answered By: Energeneer

I get this ERROR: executor failed running [...]: exit code: 100 error message when I mistyped the name of a package.

This was in my Dockerfile:

RUN sudo apt-get update; 
    sudo apt-get -y upgrade; 
    sudo apt-get install -y gnupg2 wget lsb_release 

instead of this:

RUN sudo apt-get update; 
    sudo apt-get -y upgrade; 
    sudo apt-get install -y gnupg2 wget lsb-release 

(see the difference between the underscore and the dash.)

Fixing the package name solved the problem.

Answered By: Csongor Halmai

I had this error and I think it was because I installed buildx but the version of the plugin didn’t match my docker installation. Uninstalling buildx resolved the issue for me:

docker buildx uninstall
Answered By: jaksco

For me adding this to the Dockerfile did the job:

RUN apk add --update linux-headers;
Answered By: Sasa Blagojevic
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.