Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uwsgi running in Docker can't find initializtion file

I use Ubuntu 14.04 and Docker 1.0.1. I have a container that contains of python 2.7.6 and uwsgi 2.0.10. I created the Dockerfile:

FROM romeus/python 
MAINTAINER Me <my email>
ENV REFRESHED_AT 2015-03-17

RUN pip install uwsgi
RUN pip install Django 

RUN mkdir -p /var/www
RUN mkdir -p /var/conf 

VOLUME ["/var/www"]
ADD uwsgi.conf /var/conf/


CMD ["uwsgi", "--ini", "/var/conf/uswgi.conf"]

Below I place my uswgi.conf:

[uwsgi]
http-socket = 0.0.0.0:8080
wsgi-file = /var/www/test.py 
processes = 4
threads = 2
stats = 0.0.0.0:8081

When I log in to container:

docker run --rm -it -p 8080 -p 8081 -v /home/hedin/projects/business
/project/test/www:/var/www/ romeus/django /bin/bash

And then run uwsgi with ini-file:

uwsgi --ini /var/conf/uwsgi.conf

It's starts and works as expected.

But when I run it:

docker run --rm -it -p 8080 -p 8081 -v /home/hedin/projects/business/project/test/www:/var/www/ romeus/django

It's issues an error: realpath() of /var/conf/uswgi.conf failed: No such file or directory [core/utils.c line 3607]

Does anybody knows what's a problem ?

P.S. I changed a tail of my Dockerfile:

COPY uwsgi.conf /var/conf/

VOLUME ["/var/www"]

CMD ["strace", "-f", "uwsgi", "--ini", "/var/conf/uswgi.conf"]

This is last few lines of strace's output:

lstat("/var/conf/uswgi.conf", 0x7fff9dcc6a40) = -1 ENOENT (No such file   or directory)
lstat("/var", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/var/conf", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/var/conf/uswgi.conf", 0x7fff9dcc59e0) = -1 ENOENT (No such file or directory)
write(2, "realpath() of /var/conf/uswgi.co"..., 94realpath() of /var/conf/uswgi.conf failed: No such file or directory [core/utils.c line 3607]
) = 94
exit_group(1)                           = ?
+++ exited with 1 +++

So it seems like file doesn't exists at the command run time. Any thoughts ?

like image 309
Roman Storozhenko Avatar asked Oct 14 '25 06:10

Roman Storozhenko


1 Answers

I made a stupid mistake. File name must be 'uwsgi.conf', but not 'uswgi.conf'. When I fixed it, all started work as expected.

like image 192
Roman Storozhenko Avatar answered Oct 16 '25 21:10

Roman Storozhenko