gpt4 book ai didi

nginx - Dockerized Nginx上游错误通过Flask/uWSGI应用程序提供了单独的Docker容器

转载 作者:行者123 更新时间:2023-12-02 19:12:27 25 4
gpt4 key购买 nike

在运行docker-compose build && docker-compose并尝试访问我的索引页面后,我的多容器Docker安装程序遇到以下错误:

 [error] 8#8: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.99.1, server: localhostz, request: "GET / HTTP/1.1", upstream: "uwsgi://172.17.0.39:8000", host: "192.168.99.100"

这是我的docker-compose.yml:
web:
restart: always
build: ./web-app
expose:
- "8000"
command: /usr/local/bin/uwsgi --ini sample-uwsgi.ini

nginx:
restart: always
build: ./nginx/
ports:
- "80:80"
links:
- web:web

nginx / Dockerfile
FROM nginx
RUN rm /etc/nginx/conf.d/default.conf
ADD sample-nginx.conf /etc/nginx/conf.d/

nginx / sample-nginx.conf
upstream flask {
server web:8000;
}

server {

listen 80;
server_name localhostz;
charset utf-8;
client_max_body_size 75M;

location / {
uwsgi_pass flask;
include uwsgi_params;
}
}

网络应用程序/ Dockerfile
FROM ansible/ubuntu14.04-ansible:stable

WORKDIR /root
ADD application.py application.py
ADD requirements.txt requirements.txt
ADD sample-uwsgi.ini sample-uwsgi.ini

ADD ansible /srv/ansible
WORKDIR /srv/ansible

RUN ansible-playbook container-bootstrap.yml -c local

web-app / sample-uswgi.ini
[uwsgi]

module = application
callable = app

master = true
processes = 5

socket = web:8000

chown-socket = www-data:www-data

vacuum = true
enable-threads=True
die-on-term = true

请不要发布有关单个容器设置的建议。我正在做的一项练习是能够扩展在单个nginx容器下提供服务的Docker应用程序容器。

最佳答案

secret 调味料将sample-uwsgi.ini中的套接字行更改为:

socket = 0.0.0.0:8000

关于nginx - Dockerized Nginx上游错误通过Flask/uWSGI应用程序提供了单独的Docker容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32484061/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com