[!NOTE]

这个错误是由于APT在更新后尝试执行清理脚本时失败导致的,常见于Docker环境中。以下是解决方案:

# 1.禁用APT自动清理脚,在Dockerfile中添加以下命令,彻底禁用APT的Post-Invoke清理脚本:
RUN rm -f /etc/apt/apt.conf.d/docker-clean
# 2.手动清理APT缓存,在apt update后添加显式清理命令:
RUN apt update && apt clean && rm -rf /var/lib/apt/lists/*
完整修复方案
RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
    echo "deb [arch=amd64] http://192.168.50.60:8001/ubuntu/mirror/archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse" > /etc/apt/sources.list && \
    echo "deb [arch=amd64] http://192.168.50.60:8001/ubuntu/mirror/archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse" >> /etc/apt/sources.list && \
    echo "deb [arch=amd64] http://192.168.50.60:8001/ubuntu/mirror/archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
    echo "deb [arch=amd64] http://192.168.50.60:8001/ubuntu/mirror/archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse" >> /etc/apt/sources.list && \
    echo "deb [arch=amd64] http://192.168.50.60:8001/ubuntu/mirror/archive.ubuntu.com/ubuntu/ jammy-proposed main restricted universe multiverse" >> /etc/apt/sources.list && \
    rm -f /etc/apt/apt.conf.d/docker-clean && \
    apt update && apt install -y libgl1 && \
    apt clean && rm -rf /var/lib/apt/lists/*

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐