繁体   English   中英

无法访问 Docker 中的“uwsgi”网关

[英]Unable to access “uwsgi” gateway in Docker

我想在 Kubernetes 中部署一个 Django 项目。 现在我正在创建一个 docker 图像来了解该项目。

Dockerfile

FROM python:3.7 
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip3 install -r requirements.txt

docker-compose.yml

version: '3'
services:
  mysql:
    image: mysql:5.7
    volumes:
      - ./mysql:/var/lib/mysql
    expose:
      - "3306"
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=nlpapp
      - MYSQL_USER=root
      - MYSQL_PASSWORD=root
  nginx:
    image: nginx:alpine
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx/conf:/etc/nginx/conf.d
      - ./web/staticfiles:/django_static
    ports:
      - "80:80"
    depends_on:
      - web
  redis:
    image: redis:alpine
    expose:
      - "6379"
    restart: always
  web:
    build: .
    command: uwsgi --ini uwsgi.ini
    working_dir: /code/blog
    volumes:
      - .:/code
    expose:
      - "8000"
    depends_on:
      - mysql
      - redis
  celery:
    build: .
    command: celery -A blog worker -l info
    working_dir: /code/blog
    volumes:
      - .:/code
    depends_on:
      - mysql
      - redis

uwsgi.ini

[uwsgi]
socket=:8000
chdir=/code/blog
module=blog.wsgi:application
pidfile=/tmp/blog-master.pid
master=True
vacuum=True
processes=1
max-requests=5000

要求.txt

absl-py==0.8.1
amqp==2.5.1
argcomplete==1.10.0
astor==0.8.0
beautifulsoup4==4.8.0
billiard==3.6.1.0
celery==4.3.0
certifi==2019.9.11
cffi==1.13.1
chardet==3.0.4
cloudinary==1.18.2
colorama==0.4.1
contractions==0.0.21
cryptography==2.8
Django==2.2.6
django-bootstrap4==1.0.1
django-celery-beat==1.5.0
django-mysql==3.2.0
django-timezone-field==3.1
django-widget-tweaks==1.4.5
docx2txt==0.8
EbookLib==0.17.1
extract-msg==0.23.1
gast==0.2.2
google-pasta==0.1.7
grpcio==1.24.1
h5py==2.10.0
idna==2.8
IMAPClient==2.1.0
importlib-metadata==0.23
joblib==0.14.0
Keras==2.0.5
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.0
kombu==4.6.5
log3==0.1.7
lxml==4.4.1
Markdown==3.1.1
mock==3.0.5
more-itertools==7.2.0
mysqlclient==1.4.4
nltk==3.4.5
numpy==1.17.3
olefile==0.46
pandas==0.25.2
pdfminer.six==20181108
Pillow==6.2.1
# pkg-resources==0.0.0
protobuf==3.10.0
pyahocorasick==1.4.0
pycparser==2.19
pycryptodome==3.9.0
PyJWT==1.7.1
PyPDF2==1.26.0
python-crontab==2.4.0
python-dateutil==2.8.0
python-pptx==0.6.18
pytz==2019.3
PyYAML==5.1.2
redis==3.3.11
requests==2.22.0
schedule==0.6.0
scikit-learn==0.21.3
scipy==1.3.1
six==1.12.0
sklearn==0.0
slug==2.0
slugify==0.0.1
sortedcontainers==2.1.0
soupsieve==1.9.4
SpeechRecognition==3.8.1
sqlparse==0.3.0
tensorboard==2.0.0
tensorflow==2.0.0
tensorflow-estimator==2.0.0
termcolor==1.1.0
textract==1.6.3
textsearch==0.0.17
Theano==1.0.4
tzlocal==1.5.1
unicode-slugify==0.1.3
Unidecode==1.1.1
unsplash-search==0.2.0
urllib3==1.25.6
vine==1.3.0
Werkzeug==0.16.0
wrapt==1.11.2
xlrd==1.2.0
XlsxWriter==1.2.2
zipp==0.6.0

这些是主要文件。 when I'm going to start docker-compose up command on that time MySQL, Redis, nginx, celery containers are working properly but WSGI(web) container is not running and showing an error.

错误:对于 web 无法启动服务 web:OCI 运行时创建失败:container_linux.go:345:启动容器进程文件导致“exec:\”

错误:启动项目时遇到错误

将命令更改为:

command: /usr/local/bin/uwsgi --ini uwsgi.ini

并确保在/code/blog中有uwsgi.ini并且在requirements.txt文件uwsgi列出了 uwsgi

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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