我正在嘗試在 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錯誤

更新:
當我插入了錯誤的IPDJANGO_ALLOWED_HOSTS=localhost 127.0.0.1中settings.py,該網站出現的泊塢窗容器,但然后我得到server error 500。當我插入正確的液滴 IP 地址時,出現502 Bad Gateway - nginx/1.21.3錯誤`,并且網站的容器不再出現在液滴上。
uj5u.com熱心網友回復:
在液滴上我做了
docker ps -a 它出現了!
33 minutes ago Exited (3) 33 minutes ago
所以我跟著它
docker logs <container name>
錯誤是在 ALLOWED_HOSTS
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/319069.html
