Using AWS instance based on ubuntu 18.04, Docker version 19.03.10, build 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:
sudo docker build -t my_username/repository .
Here is my 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. 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
.
Besides, in your Dockerfile, there should be only one CMD
, what you need is RUN
instruction instead of CMD
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.