python pip- 这些包与使用 docker 安装 rasa 的要求文件中的哈希值不匹配

python pip- These packages do not match the hashes from the requirements file installing rasa with docker

我正在从这个 docker 文件构建这个图像

FROM python:3.8.0

WORKDIR /app

# Install system libraries
RUN apt-get update && \
    apt-get install -y git && \
    apt-get install -y gcc

# Install project dependencies
COPY ./requirements.txt .

RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt --use-deprecated=legacy-resolver

# Don't use terminal buffering, print all to stdout / err right away
ENV PYTHONUNBUFFERED 1

这是我的requirements.txt文件

aiohttp==3.6.2
rasa==2.4.1
rasa-sdk==2.4.1

# Rasa requirements
python-dateutil~=2.8
SQLAlchemy==1.3.23
gast==0.3.3

构建镜像的命令

docker build -f base_Dockerfile -t rasa_base:latest

但这显示了这个错误

#9 529.6 ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
#9 529.6     tensorflow<2.4,>=2.3 from https://files.pythonhosted.org/packages/10/f9/283e82c10958fc24eb120fea6c40f1d8a66507a85818de420138bbbf88bf/tensorflow-2.3.2-cp38-cp38-manylinux2010_x86_64.whl#sha256=c85d29c7b5c000b196200a25e18a5905cc04f75c989e508f8fd110f3b2c4b4fe (from rasa==2.4.1->-r requirements.txt (line 2)):
#9 529.6         Expected sha256 c85d29c7b5c000b196200a25e18a5905cc04f75c989e508f8fd110f3b2c4b4fe
#9 529.6              Got        c29a17cebd72dd06fecffd646fa0990c9b7f7b5781d8746b70d821109125f9c9
#9 529.6
------
executor failed running [/bin/sh -c pip install --no-cache-dir -r requirements.txt --use-deprecated=legacy-resolver]: exit code: 1

我已经删除了所有的图像,甚至我在安装deps时都在使用--no-cache-dir

问题出在缓存和未使用的图像上。这个命令帮助了我

docker system prune -a

删除所有悬挂图像。如果指定 -a,还将删除所有未被任何容器引用的图像