PlayMa256
PlayMa256

Reputation: 6841

running uwsgi on docker causing no such file or directory

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?

Upvotes: 1

Views: 1768

Answers (1)

gaoxinge
gaoxinge

Reputation: 461

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.

Upvotes: 2

Related Questions