简体   繁体   中英

Docker container has different behaviour on server than local machine - uwsgi and nginx

My docker container seems to deploy correctly when running it from my MacOS machine, but fails to import the app module when running from my remote Ubuntu 18.04 server. It is a flask app that uses uwsgi and nginx as a web server. Exact error is

ImportError: No module named 'app'

I have tried different configurations of the various files below, without any success.

Dockerfile:

FROM python:3.5

RUN apt-get update
RUN apt-get install -y --no-install-recommends \
        libatlas-base-dev gfortran nginx supervisor

RUN pip3 install uwsgi

COPY requirements.txt /project/requirements.txt

RUN pip3 install -r /project/requirements.txt

RUN useradd --no-create-home nginx

RUN rm /etc/nginx/sites-enabled/default
RUN rm -r /root/.cache

COPY nginx.conf /etc/nginx/
COPY flask-site-nginx.conf /etc/nginx/conf.d/
COPY uwsgi.ini /etc/uwsgi/
COPY supervisord.conf /etc/

COPY /app /project

WORKDIR /project

CMD ["/usr/bin/supervisord"]

Supervisord:

[supervisord]
nodaemon=true

[program:uwsgi]
command=/usr/local/bin/uwsgi --ini /etc/uwsgi/uwsgi.ini --die-on-term
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:nginx]
command=/usr/sbin/nginx
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

uwsgi:

[uwsgi]
module = app.wsgi
callable = app

uid = nginx
gid = nginx

socket = /tmp/uwsgi.sock
chown-socket = nginx:nginx
chmod-socket = 664

cheaper = 1
processes = %(%k + 1)

Really appreciate any input or advice - thanks in advance!

Possible explanation:

On OS X, the default is a case-insensitive file system.

On Ubuntu, you almost certainly have a case-sensitive file system.

Do you use a file called Supervisord which is the same as supervisord on a case-insensitive file system but not on a case-sensitive one?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM