简体   繁体   English

docker:在 $PATH 中找不到可执行文件”:未知

[英]docker: executable file not found in $PATH": unknown

Using AWS instance based on ubuntu 18.04, Docker version 19.03.10, build 9424aeaee9.使用基于 ubuntu 18.04、Docker 版本 19.03.10 的 AWS 实例,构建 9424aeaee9。 I got the following error:我收到以下错误:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"python\": executable file not found in $PATH": unknown.

after trying to execute the code:尝试执行代码后:

docker run --name test1 c73eada5a5fa

where "c73eada5a5fa" is my container id after being built using:使用以下命令构建后,“c73eada5a5fa”是我的容器 ID:

sudo docker build -t my_username/repository .

Here is my docker:这是我的 docker:

FROM ubuntu:18.04
COPY . /PFE_exec
CMD ["make", "PFE_exec"]
CMD ["sudo","apt","install","unzip"]
CMD ["echo","requirements installed!"]
CMD ["unzip","home/ubuntu/PFE/aa.zip"]
CMD ["python","home/ubuntu/PFE/test.py"]
CMD ["python","home/ubuntu/PFE/test2.py"]
CMD ["python","home/ubuntu/PFE/test3.py"]

Using python3 instead of python doesn't resolve the problem as well.使用 python3 而不是 python 也不能解决问题。 I don't understand where is the problem.我不明白问题出在哪里。 Any help?有什么帮助吗? Thank you in advance!先感谢您!

There is no python or python3 pre-installed in ubuntu:18.04 image, if you want to use python in your Docker, you probably want to change your base image to python image , eg FROM python:3 . ubuntu:18.04镜像中没有pythonpython3 ,如果你想在你的 Docker 中使用 python,你可能需要将基础镜像更改为python 镜像,例如FROM python:3

Besides, in your Dockerfile, there should be only one CMD , what you need is RUN instruction instead of CMD .此外,在你的 Dockerfile 中,应该只有一个CMD ,你需要的是RUN指令,而不是CMD

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

相关问题 在 $PATH 中找不到 Docker 撰写可执行文件”:未知 - Docker compose executable file not found in $PATH": unknown Docker 安装映像错误可执行文件未在 $PATH 中找到:未知 - Docker mounting image error executable file not found in $PATH: unknown uWSGI + Docker:pyuwsgi:在$ PATH中找不到可执行文件 - uWSGI + Docker: pyuwsgi: executable file not found in $PATH docker-compose exec: \“webserver\”: $PATH 中找不到可执行文件 - docker-compose exec: \“webserver\”: executable file not found in $PATH 如何解决“exec:\”Python\“:$PATH 中找不到可执行文件”:未知。 用于 AWS 上的简单 python 脚本 - How to solve “exec: \”Python\“: executable file not found in $PATH”: unknown. for simple python script on AWS 启动容器进程导致:exec:“uvicorn”:$PATH 中找不到可执行文件:未知 - starting container process caused: exec: "uvicorn": executable file not found in $PATH: unknown 从python运行时,Docker映像给我“在$ PATH中找不到可执行文件” - Docker image gives me “executable file not found in $PATH” when run from python "exec: "python": $PATH 中找不到可执行文件 - "exec: "python": executable file not found in $PATH exec: "python": 在 $PATH 中找不到可执行文件 - exec: "python": executable file not found in $PATH “python”:在 M1 上的 $PATH 中找不到可执行文件 - "python": executable file not found in $PATH on M1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM