Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

895
Vistas
Error running docker container: starting container process caused "exec: \"python\": executable file not found in $PATH": unknown

I am trying to dockerize a simple Python-Flask application but I am getting an error while running my container.

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.

Workdir on 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" ]

Commands:

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

Expected : Flask web should run on port 5000

Actual Result:

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 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

There is no /usr/bin/python in a docker image built by the code above. But there is /usr/bin/python3. So you could either use python3 directly as your ENTRYPOINT or create a symlink.

over 4 years ago · Santiago Trujillo Denunciar

0

I was getting the same issue except that it was yelling some other number than 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. and the docker file was

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" ]

I changed the line ENTRYPOINT [ "python" ] to ENTRYPOINT [ "python3" ] Now it is working fine. The reason for this was that above I had used Python3 so there was no candidate for Python rather there were for Python3.

RUN apt-get install -y python3
RUN apt-get install -y python3-pip
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda