Reputation: 1
Suddenly my Dockerfile
raised an error:
ERROR: failed to solve: cannot copy to non-directory: /var/lib/docker/overlay2/unmqsp2hwigzv0yjeufoloalx/merged/usr/share/zoneinfo/posix/Africa
My Dockerfile:
FROM python:3.9-slim as build
WORKDIR /app
COPY requirements.txt /requirements.txt
FROM gcr.io/distroless/python3-debian11
COPY . /app
WORKDIR /app
COPY --from=build /app /app
COPY --from=build /usr/local/lib/python3.9/site-packages /usr/lib/python3.9
ENV PYTHONUNBUFFERED=1
EXPOSE 5000
CMD ["src/standalone.py"]
I tried to add below command but an error still occured:
RUN mkdir -p /usr/share/zoneinfo/posix/Africa
Then I tried to modify command which is the source of the error:
FROM: COPY --from=build /usr /usr
TO: COPY --from=build /usr/ /usr/
Upvotes: 0
Views: 58
Reputation: 148
I'm not sure why you are using multi stage build for this app, but you could update your Dockerfile to something like (just select the best python image for you):
# FROM python:3.9-slim as build
FROM gcr.io/distroless/python3-debian11
RUN mkdir /app
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
ENV PYTHONUNBUFFERED=1
EXPOSE 5000
CMD ["src/standalone.py"]
I'm assuming that your Dockerfile
and requirements.txt
are inside your application folder.
Upvotes: 1