构建 docker 映像时出错“执行程序运行失败 [/bin/sh -c apt-get -y update]”

bor*_*nax 29 python docker

我正在尝试构建一个 docker 映像,但它抛出一个错误,我似乎不明白为什么。

它卡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
Run Code Online (Sandbox Code Playgroud)

这是我的泊坞窗文件:

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 .
Run Code Online (Sandbox Code Playgroud)

这里发生了什么?

小智 20

就我而言,docker 仍在使用缓存的RUN apt update && apt upgrade命令,因此没有更新包源。

解决方案是使用以下标志构建一次 docker 映像--no-cache

docker build --no-cache .
Run Code Online (Sandbox Code Playgroud)


Tua*_*ran 6

这里回答了https://askubuntu.com/questions/1059217/getting-release-is-not-valid-yet-while-updating-ubuntu-docker-container

更正您的系统时钟。(在评论中我还建议检查时钟和时区之间是否不匹配)


nit*_*adi 5

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