docker-compose.yml:
version: "3.3"
services:
flask_app:
build: ./flask_app
container_name: flask_app
restart: always
environment:
- APP_NAME=MyFlaskApp
expose:
- 8080
nginx:
build: ./nginx
container_name: nginx
restart: always
ports:
- "80:80"
nginx.conf
server {
listen 80;
charset UTF-8;
client_max_body_size 30M;
location / {
include uwsgi_params;
uwsgi_pass flask:8080;
}
}
uwsgi.ini
[uwsgi]
wsgi-file = app.py
callable = app
socket = :8080
processes = 4
threads = 2
master = true
chmod-socket = 660
vacuum = true
die-on-term = true
buffer-size = 65535
limit-post = 104857600
logto = /flask_app/app.log
Dockerfile
FROM python:3.6
WORKDIR /app
ADD . /app
RUN pip install -r requirements.txt
CMD ["uwsgi", "uwsgi.ini"]
以上分别是我 docker-compose, nginx, uwsgi 以及 dockerfile 的配置,但是启动话只有 nginx 启动了,另外一个一直在重启的状态,求解
1
cdlnls 2022-12-16 22:24:35 +08:00
看看日志是什么报错了
|
2
sevenandeleven OP @cdlnls 这个 unable to load configuration from
|
3
fzzff 2022-12-30 15:48:24 +08:00
docker-compose.yml 的目录层级放哪了, 是不是 build 指定路径不对找不到对应的 Dockerfile
|
4
sevenandeleven OP @fzzff build 执行了 dockerfile ,安装了项目所需的 Python 包,flask_app 这个容器一直重启,unable to load configuration from -,这个是报错
|
5
alexsz 2023-01-05 17:01:04 +08:00
google 搜索 uwsgi + unable to load configuration from 看到这个:
https://stackoverflow.com/questions/34615743/unable-to-load-configuration-from-uwsgi 可以参考下 |