1

I'm trying to run an application using uwsgi inside a docker container, but i'm getting

docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"uwsgi --http :80 -s /tmp/uwsgi.sock --pidfile /var/run/uwsgi.pid --wsgi-file /app/api.py -M -p 4 --die-on-term --callable app -d /tmp/uwsgi.log\": stat uwsgi --http :80 -s /tmp/uwsgi.sock --pidfile /var/run/uwsgi.pid --wsgi-file /app/api.py -M -p 4 --die-on-term --callable app -d /tmp/uwsgi.log: no such file or directory": unknown.

my docker file:

FROM ubuntu


RUN apt-get update && apt-get install -y build-essential python-dev python-pip

RUN pip install uwsgi

RUN pip install Flask


EXPOSE 9090

COPY ./flask /app
WORKDIR /app

CMD ["uwsgi --http :80 -s /tmp/uwsgi.sock  --pidfile /var/run/uwsgi.pid --wsgi-file /app/api.py -M -p 4 --die-on-term --callable app -d /tmp/uwsgi.log"]

What could i do to run that successfully?

PlayMa256
  • 6,603
  • 2
  • 34
  • 54

1 Answers1

2

You can try the CMD exec form

CMD ["uwsgi", "--http", ":80", "-s", "/tmp/uwsgi.sock",  "--pidfile", "/var/run/uwsgi.pid", "--wsgi-file", "/app/api.py", "-M", "-p", "4", "--die-on-term", "--callable", "app", "-d", "/tmp/uwsgi.log"] 

instead of

CMD ["uwsgi --http :80 -s /tmp/uwsgi.sock  --pidfile /var/run/uwsgi.pid --wsgi-file /app/api.py -M -p 4 --die-on-term --callable app -d /tmp/uwsgi.log"]

Wish this answer is helpful to you and Dockerfile CMD shell versus exec form is the reference.

gaoxinge
  • 459
  • 2
  • 8
  • 21