“sudo docker-compuse up”让我被引导工人冻结/卡住

问题描述 投票:0回答:0

我正在尝试让我的 docker-compose 启动,但它在工作人员启动时卡住了 如果我尝试转到本地主机端口,它也会显示“无法访问该站点”页面

Docker文件:

FROM docker.io/python:3.10

WORKDIR /

# --- [Install python and pip] ---
RUN apt-get update && apt-get upgrade -y && \
    apt-get install -y python3 python3-pip git
COPY . /

RUN pip install --no-cache-dir -r requirements.txt
RUN pip install gunicorn

# --- ADDED TIMEOUT FOR FIX ---
ENV GUNICORN_CMD_ARGS="--workers=3 --bind=0.0.0.0:8080 --timeout=1000"

EXPOSE 8080

CMD [ "gunicorn", "main:app" ]

我的 docker-compose 文件:

version: '3'
services:
        web:
                image: runtime_t_v1
                build: .
                ports:
                        - "8032:8080"
                volumes:
                        - ./volumes:/volumes
                        - ./instance:/instance
                restart: unless-stopped

这是错误:

(base) Theo@Theo runtime_flask % sudo docker-compose up
[+] Running 1/0
 ⠿ Container runtime_flask-web-1  Created                                                                                       0.0s
Attaching to runtime_flask-web-1
runtime_flask-web-1  | [2023-04-07 20:23:34 +0000] [1] [INFO] Starting gunicorn 20.1.0
runtime_flask-web-1  | [2023-04-07 20:23:34 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
runtime_flask-web-1  | [2023-04-07 20:23:34 +0000] [1] [INFO] Using worker: sync
runtime_flask-web-1  | [2023-04-07 20:23:34 +0000] [7] [INFO] Booting worker with pid: 7
runtime_flask-web-1  | [2023-04-07 20:23:34 +0000] [8] [INFO] Booting worker with pid: 8
runtime_flask-web-1  | [2023-04-07 20:23:34 +0000] [9] [INFO] Booting worker with pid: 9

当我查找问题时,人们要么在 gunicorn 上设置超时,要么在 Docker 上增加内存上限。我都试过了,但都没有用。您还可以在我的 docker-compose 文件中看到我添加到 gunicorn 的超时。我已经尝试了所有我在网上看到的相同问题,但没有任何效果,但也许我只是做错了什么。

docker docker-compose deployment gunicorn
© www.soinside.com 2019 - 2024. All rights reserved.