簡體   English   中英

Docker 容器未運行 - Docker-compose

[英]Docker container not running - Docker-compose

我正在嘗試在 docker 容器中運行 django-react 應用程序並嘗試將其部署在數字海洋上。

這是我的 docker-compose 腳本

version: "3.9"

services:
  web:
    image: "${WEB_IMAGE}"
    container_name: website
    command: gunicorn server.wsgi:application --bind 0.0.0.0:8000
    volumes:
      - static_volume:/usr/src/app/staticfiles
      - media_volume:/usr/src/app/mediafiles
    ports:
      - 8000:8000
    env_file: .env

  nginx:
    image: "${NGINX_IMAGE}"
    container_name: nginx
    volumes:
      - static_volume:/usr/src/app/staticfiles
      - media_volume:/usr/src/app/mediafiles
    ports:
      - 80:80
    depends_on:
      - web

  tensorflow-servings:
    image: "${TENSORFLOW_IMAGE}"
    container_name: tensorflow_serving
    ports:
      - 8501:8501
    depends_on:
      - web

volumes:
  static_volume:
  media_volume:

在這里你會看到 nginx 和 web 被列出,但沒有 web。 我收到502 Bad Gateway - nginx/1.21.3錯誤

在此處輸入圖片說明

更新:

當我插入了錯誤的IP DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1settings.py ,該網站出現的泊塢窗容器但后來我得到server error 500 當我插入502 Bad Gateway - nginx/1.21.3的正確 IP 地址時,我收到502 Bad Gateway - nginx/1.21.3錯誤`,並且網站的容器不再出現在 Droplet 上。

在液滴上我做了

docker ps -a出現了!

33 minutes ago Exited (3) 33 minutes ago

所以我跟着它

docker logs <container name>

錯誤在ALLOWED_HOSTS

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM