构建Docker映像时出错'执行器运行[/bin/sh -c apt-get -y update]失败'

5lhxktic  于 2022-11-22  发布在  Docker
关注(0)|答案(6)|浏览(2098)

我试图建立一个码头形象,但它抛出了一个错误,我似乎不能找出原因。
它停留在RUN apt-get -y update,并显示以下错误消息:

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

以下是我的Docker文件:

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 .

这是怎么回事?

ulmd4ohb

ulmd4ohb1#

如果您使用的是Docker桌面,请检查是否在设置/首选项中设置了足够的资源。例如,内存和磁盘要求

ttisahbt

ttisahbt2#

当我输入了错误的软件包名称时,我得到了这个ERROR: executor failed running [...]: exit code: 100错误消息。
这是在我的Dockerfile:

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

而不是:

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

(see下划线和破折号之间的区别。)
修正套件名称解决了问题。

h7appiyu

h7appiyu3#

这种情况也会发生在特定的操作系统上。
我在我的Windows 10上运行MariaDB也遇到了同样的问题。
检查Docker设置:

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

删除下面的块,它应该可以工作:

"features": {
    "buildkit": true
  },
wnrlj8wa

wnrlj8wa4#

我遇到了这个错误,我想这是因为我安装了buildx,但是插件的版本与我安装的docker不匹配。卸载buildx为我解决了这个问题:

docker buildx uninstall
e3bfsja2

e3bfsja25#

在我的例子中,docker仍然使用缓存的RUN apt update && apt upgrade命令,因此没有更新包源代码。
解决方案是使用--no-cache标志构建一次docker映像:

docker build --no-cache .
7kjnsjlb

7kjnsjlb6#

在这里回答https://askubuntu.com/questions/1059217/getting-release-is-not-valid-yet-while-updating-ubuntu-docker-container
更正你的系统时钟。(在评论中我还建议检查时钟和你的时区之间的不匹配)

相关问题