简体   繁体   English

OCI 运行时创建失败:runc 创建失败:无法启动容器进程:exec:“split_csv.py”:在 $PATH 中找不到可执行文件:未知

[英]OCI runtime create failed: runc create failed: unable to start container process: exec: "split_csv.py": executable file not found in $PATH: unknown

My dockerfile我的码头文件

FROM python:latest来自python:最新

#ENTRYPOINT [ "python split_csv.py -i test_data.csv -o test_data.csv -r 100" ] #ENTRYPOINT [“python split_csv.py -i test_data.csv -o test_data.csv -r 100”]

WORKDIR /docker_task2工作目录 /docker_task2

ENV PORT 80环境端口 80

COPY split_csv.py ./docker_task2复制 split_csv.py ./docker_task2

ADD test_data.csv ./docker_task2添加 test_data.csv ./docker_task2

COPY .复制 。 /docker_task2// /docker_task2//

CMD ["python", "split_csv.py", "test_data.csv"] CMD ["python", "split_csv.py", "test_data.csv"]

My code我的代码

docker run splitter split_csv.py -i test_data.csv -o test_data.csv -r 100 docker run splitter split_csv.py -i test_data.csv -o test_data.csv -r 100

When you start the container当你启动容器

docker run splitter \
  split_csv.py -i test_data.csv -o test_data.csv -r 100

it tries to look up the command split_csv.py in the $PATH environment variable, following the normal Unix rules.它尝试按照正常的 Unix 规则在$PATH环境变量中查找命令split_csv.py You've copied your script into the /docker_task2 directory in the image, which is also the current directory, and you need to explicitly specify the path since the directory isn't one of the default $PATH locations like /usr/bin .您已将脚本复制到映像中的/docker_task2目录中,该目录也是当前目录,并且您需要明确指定路径,因为该目录不是像/usr/bin这样的默认$PATH位置之一。

docker run splitter \
  ./split_csv.py ...

This is also subject to the other normal Unix rules here: the script must be executable (run chmod +x split_csv.py on your host system if it isn't, and commit that permission change to source control) and it must begin with a "shebang" line #!/usr/bin/env python3 as the very first line of the file.这也受制于此处的其他正常 Unix 规则:脚本必须是可执行的(如果不是,则在您的主机系统上运行chmod +x split_csv.py ,并将该权限更改提交给源代码控制),并且它必须以"shebang" line #!/usr/bin/env python3作为文件的第一行。

Having fixed this, you also don't need to repeat the python interpreter in your image's CMD .修复此问题后,您也无需在图像的CMD中重复python解释器。 You can probably simplify the Dockerfile significantly:您可能可以显着简化 Dockerfile:

FROM python:latest
WORKDIR /docker_task2

# Install Python library dependencies first; saves time on rebuild
# COPY requirements.txt ./
# RUN pip install -r requirements.txt

# Copy the entire context directory ./ to the current directory ./
COPY ./ ./

# Set defaults to run the image
ENV PORT 80
CMD ["./split_csv.py", "-i", "test_data.csv"]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 OCI 运行时创建失败:container_linux.go:349:启动容器进程导致“exec:\\”xxxx\\“:在 $PATH 中找不到可执行文件”:未知 - OCI runtime create failed: container_linux.go:349: starting container process caused “exec: \”xxxx\“: executable file not found in $PATH”: unknown OCI 运行时创建失败:container_linux.go:348:启动容器进程导致“exec:\\”-it\\“:在 $PATH 中找不到可执行文件”:未知 - OCI runtime create failed: container_linux.go:348: starting container process caused “exec: \”-it\“: executable file not found in $PATH”:unknown Docker:OCI 运行时创建失败:container_linux.go:349:启动容器进程导致“exec:\”java\“:$PATH 中找不到可执行文件” - Docker: OCI runtime create failed: container_linux.go:349: starting container process caused “exec: \”java\“: executable file not found in $PATH” OCI 运行时创建失败:container_linux.go:349:启动容器进程导致“exec:\\”r-base\\“:在 $PATH 中找不到可执行文件”:未知 - OCI runtime create failed: container_linux.go:349: starting container process caused “exec: \”r-base\“: executable file not found in $PATH”: unknown 如何解决 docker OCI 运行时创建失败的启动容器进程导致“exec:\”java\“:$PATH 中找不到可执行文件”: - How to solve docker OCI runtime create failed starting container process caused “exec: \”java\“: executable file not found in $PATH”: OCI 运行时执行失败:执行失败:(...)$PATH 中找不到可执行文件“:未知 - OCI runtime exec failed: exec failed: (...) executable file not found in $PATH": unknown OCI runtime exec failed: exec failed: unable to start container process: open /dev/pts/0: operation not permitted: 未知 - OCI runtime exec failed: exec failed: unable to start container process: open /dev/pts/0: operation not permitted: unknown Docker:OCI运行时创建失败:在$ PATH中找不到可执行文件 - Docker : OCI runtime create failed: executable file not found in $PATH 启动 docker 容器失败。 “创建 shim 任务失败:OCI 运行时创建失败:runc 创建失败” - Failure starting docker container. "failed to create shim task: OCI runtime create failed: runc create failed" 无法重新启动容器 OCI 运行时创建失败:container_linux.go:367:启动容器进程导致:exec:: 权限被拒绝:未知 - Cannot restart container OCI runtime create failed: container_linux.go:367: starting container process caused: exec:: permission denied: unknown
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM