• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

832
Views
Error al ejecutar el contenedor docker: iniciar el proceso del contenedor causó "exec: \"python\": archivo ejecutable no encontrado en $PATH": desconocido

Estoy tratando de dockerizar una aplicación Python-Flask simple, pero recibo un error mientras ejecuto mi contenedor.

ventana acoplable: Respuesta de error del daemon: Error al crear el tiempo de ejecución de OCI: container_linux.go:344: el inicio del proceso del contenedor causó "exec: \"python\": archivo ejecutable no encontrado en $PATH": desconocido.

Workdir en localhost:

 /home/ubuntu/flask_web - app.py - Dockerfile - requirements.txt

app.py

 #flask_web/app.py from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hey, we have Flask in a Docker container' if __name__ == '__main__': app.run(debug=True, host='0.0.0.0')

Dockerfile

 FROM ubuntu:16.04 MAINTAINER xyz "xyz@gmail.com" RUN apt-get update \ && apt-get install -y software-properties-common vim \ && add-apt-repository ppa:jonathonf/python-3.6 \ && apt-get update -y \ && apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv \ && pip3 install --upgrade pip # We copy just the requirements.txt first to leverage Docker cache COPY ./requirements.txt /app/requirements.txt WORKDIR /app RUN pip install -r requirements.txt COPY . /app ENTRYPOINT [ "python" ] CMD [ "app.py" ]

Comandos:

 docker build -t flask-test:latest . docker run -p 5000:5000 flask-test

Esperado: Flask web debe ejecutarse en el puerto 5000

Resultado actual:

 docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"python\": executable file not found in $PATH": unknown.
over 3 years ago · Santiago Trujillo
2 answers
Answer question

0

No hay /usr/bin/python en una imagen acoplable creada por el código anterior. Pero hay /usr/bin/python3 . Por lo tanto, puede usar python3 directamente como su ENTRYPOINT o crear un enlace simbólico.

over 3 years ago · Santiago Trujillo Report

0

Estaba teniendo el mismo problema, excepto que gritaba un número diferente al 344

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

 FROM ubuntu:20.04 RUN apt-get update -y RUN apt-get install -y python3 RUN apt-get install -y python3-pip COPY ./requirements.txt /app/requirements.txt WORKDIR /app RUN pip3 install -r requirements.txt COPY . /app ENTRYPOINT [ "python" ] CMD [ "app.py" ]

Cambié la línea ENTRYPOINT [ "python" ] a ENTRYPOINT [ "python3" ] Ahora funciona bien. La razón de esto fue que anteriormente había usado Python3, por lo que no había ningún candidato para Python, sino que había Python3.

 RUN apt-get install -y python3 RUN apt-get install -y python3-pip
over 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error