嘿谁能告诉一下这是什么原因
FileNotFoundError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/']
我正在 Docker ecs fargate 任务上运行,这会引发错误。
我尝试在本地构建并运行映像,它工作正常,但在 ecs fargate 上会抛出错误。
下面是我的 docker 文件
FROM python:3.10-slim-bullseye
RUN apt-get update \
&& apt-get install --yes build-essential python3-dev default-libmysqlclient-dev libpq-dev pkg-config\
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN groupadd -r runner && useradd -r -g runner runner
COPY requirements /requirements
RUN pip install -U pip
RUN pip install -r requirements/base.txt
COPY handler.py /
COPY document_generation /document_generation
RUN export PYTHONPATH="${PYTHONPATH}:$(pwd)";
WORKDIR /
# Create a temporary directory and set permissions
RUN mkdir -p /documents_api_tmp && chmod 777 -R /documents_api_tmp && chmod o+t -R /documents_api_tmp
ENV TMPDIR=/documents_api_tmp
# Debugging step: Check directory permissions and disk usage
RUN df -h \
&& du -sh /documents_api_tmp
USER runner
CMD ["python", "handler.py"]
我在 lambda 函数中遇到了同样的错误。你设法解决这个问题了吗?如果是这样怎么办?