无法计算缓存键:“/films”未找到:未找到?
Failed to compute cache key: "/films" not found: not found?
无法计算缓存键:未找到“/films”:未找到?
我的应用结构:
我的 Dockerfile :
FROM python:3.7
RUN useradd --create-home userapi
WORKDIR /films
COPY requirements.txt .
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
COPY films/ .
RUN crown -R userapi:userapi ./
USER userapi
EXPOSE 5000
CMD ["python", "./wsgi.py"]
我收到错误:
=> ERROR [7/8] COPY films/ .
failed to compute cache key: "/films" not found: not found
为什么找不到 films
??
您的应用程序的 Docker 文件位于 ~/Documents/films 本地目录中。当您从 ~/Documents/films 构建 Docker 图像时,此文件夹是相对路径 .
(例如 ./data
)引用的构建上下文,因此找不到通过其全名(例如电影)
您应该使用 COPY
指令将文件从 .
复制到它们在图像文件系统中的位置。如果您希望 ~/Documents/films 中的所有文件位于名为“/films”的图像的根目录中,请将指令更改为:
COPY . /films
否则,您可以像使用 COPY requirements.txt .
指令那样在构建上下文中指定要复制的 files/folders。
例如:
COPY ./data /films/data
COPY ./config.py /films/config.py
无法计算缓存键:未找到“/films”:未找到? 我的应用结构:
我的 Dockerfile :
FROM python:3.7
RUN useradd --create-home userapi
WORKDIR /films
COPY requirements.txt .
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
COPY films/ .
RUN crown -R userapi:userapi ./
USER userapi
EXPOSE 5000
CMD ["python", "./wsgi.py"]
我收到错误:
=> ERROR [7/8] COPY films/ .
failed to compute cache key: "/films" not found: not found
为什么找不到 films
??
您的应用程序的 Docker 文件位于 ~/Documents/films 本地目录中。当您从 ~/Documents/films 构建 Docker 图像时,此文件夹是相对路径 .
(例如 ./data
)引用的构建上下文,因此找不到通过其全名(例如电影)
您应该使用 COPY
指令将文件从 .
复制到它们在图像文件系统中的位置。如果您希望 ~/Documents/films 中的所有文件位于名为“/films”的图像的根目录中,请将指令更改为:
COPY . /films
否则,您可以像使用 COPY requirements.txt .
指令那样在构建上下文中指定要复制的 files/folders。
例如:
COPY ./data /films/data
COPY ./config.py /films/config.py