How to fix ERRO[0000] error waiting for container: context canceled?

Question:

docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "python": cannot run executable found relative to current directory: unknown.
ERRO[0000] error waiting for container: context canceled

# using ubuntu LTS version
FROM ubuntu:18.04

RUN groupadd -g 999 next_gen && 
    useradd -r -u 999 -g next_gen next_gen

RUN mkdir /home/next_gen && chown next_gen:next_gen /home/next_gen

WORKDIR /home/next_gen

# dependencies install
RUN apt-get update && apt-get install -y --reinstall libgtk2.0-0 
    libdc1394-22 python3-opencv libatomic1 python3 python3-venv 
    software-properties-common && 
    add-apt-repository -y ppa:deadsnakes/ppa && 
    apt-get update && apt install -y python3.7 
    python3.7-venv python3.7-dev gcc

RUN mkdir storage && mkdir logs && chown next_gen:next_gen storage && chown next_gen:next_gen logs

COPY --chown=next_gen:next_gen requirements.txt ./

ENV VIRTUAL_ENV "workflow_env"
RUN python3.7 -m venv $VIRTUAL_ENV
ENV PATH "$VIRTUAL_ENV/bin:$PATH"

RUN pip3 install --upgrade pip && 
    pip3 install -r requirements.txt

# Introduce a dummy environment variable to invalidate cache for subsequent steps
ARG CACHEBUST=1

COPY --chown=next_gen:next_gen . .

USER 999
ENTRYPOINT ["python", "/home/next_gen/app.py"]
CMD ["--ifile", "$INPUT_JSON", "--environ", "$ENV", "--process", "$PROCESS", "--disktype", "$DISK_TYPE", "--cache", "$CACHE"]
Asked By: Manabroy72

||

Answers:

ENTRYPOINT ["/home/lightmetrics/workflow_env/bin/python", "/home/lightmetrics/app.py"]

Answered By: Manabroy72

This is due to a change in the behavior of the container runtime which no longer allows path lookups to resolve to the current directory.
To solve the issue, you can use the recommended way:

["/usr/bin/env", "python", "your_args_here"]

or

 `["./python", "your_args_here"]`

or just use the absolute path to your python interpreter as suggested above, but that is not the recommended way.

Answered By: boogie
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.