Home > Enterprise >  Failed to compute cache key: "/films" not found: not found?
Failed to compute cache key: "/films" not found: not found?

Time:05-12

Failed to compute cache key: "/films" not found: not found ? My app structure:

enter image description here

My 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"]

I got error:

 => ERROR [7/8] COPY films/ .   

failed to compute cache key: "/films" not found: not found

why can't find films ??

CodePudding user response:

The Dockerfile for your app is within the ~/Documents/films local directory. When you build your Docker image from the ~/Documents/films, this folder is the build context that is referred to by relative path . (e.g. ./data) so it is not found by its full name (e.g. films)

You should use the COPY instruction to copy the files from . to their location in the image filesystem. If you want all the files in ~/Documents/films to be in a root directory of the image with the name "/films", change the instruction to:

COPY . /films

Otherwise, you can specify which files/folders you want to copy within the build context as you have done with the COPY requirements.txt . instruction.

e.g.:

COPY ./data /films/data
COPY ./config.py /films/config.py
  • Related