This is my Dockerfile for distroless image similar to this example
FROM python:3.9-slim AS build-venv
RUN python3 -m venv /venv
# other installation steps go here
RUN /venv/bin/pip install --upgrade pip setuptools wheel
# installing from requirements.txt etc.
# Copy the virtualenv into a distroless image
FROM gcr.io/distroless/python3-debian11
COPY --from=build-venv /venv /venv
ENTRYPOINT ["/venv/bin/python3"]
I'm trying to just get into Python shell (with all the dependencies installed), but docker run -it my-distroless
gives me this error
docker: Error response from daemon: failed to create shim task:
OCI runtime create failed: runc create failed:
unable to start container process: exec: "/venv/bin/python3":
stat /venv/bin/python3: no such file or directory: unknown.
But when replacing base image with debian:11-slim
everything works as expected.
FROM debian:11-slim AS build
RUN apt-get update && \
apt-get install --no-install-suggests --no-install-recommends --yes python3-venv gcc libpython3-dev && \
python3 -m venv /venv
# the rest is the same
Are there only "compatible" base images for distroless that I should use for my builds or what is the possible reason?