私はdocker-composeを使って展開するdjangoバックエンドを持っています。このdjangoアプリケーションは、前面にnginxプロキシを使用しています。nginxはdubuntuのdjango-apposeに転送しませんが、Macではdocker-machineで動作します。
私はドッカーマシンにデプロイし、ドッカーマシンのipに行くと、私はdjangoサイトに適切にリダイレクトされます。
しかし、ドッカーのubuntuマシンにデプロイすると、デフォルトのnginxページを与えられたnginxコンテナのipに移動すると、私はdjangoアプリケーションにリダイレクトされません。 nginxコンテナはエラーも記録しません。すべてのサービスはエラーなしでドッカーで実行されています。
私はnginxのの設定ファイルを共有しています、ドッキングウィンドウ-構成
server { listen 80; server_name omaha; listen 443 ssl; ssl_certificate /etc/nginx/ssl/ssl.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; charset utf-8; client_max_body_size 200M; location/{ proxy_pass http://web:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }
nginx.conf nginxの下のファイル
FROM nginx
COPY conf/nginx.conf /etc/nginx/conf.d/nginx.conf
COPY certs/ /etc/nginx/ssl
ドッキングウィンドウ・コンdockerfile。 yml
version: '2'
services:
nginx:
restart: always
build:
context: ./nginx/
ports:
- "80:80"
- "443:443"
volumes_from:
- web
web:
restart: always
build:
context: ./web
depends_on:
- web_ffmpeg
- postgres
- redis
- rabbitmq
expose:
- "8000"
environment:
- DEBUG=True
command: /usr/local/bin/gunicorn wsgi:application -w 2 -b :8000
web_ffmpeg:
restart: always
build:
context: ./web
depends_on:
- postgres
- redis
- rabbitmq
expose:
- "8000"
command: /usr/local/bin/celery -A trigger worker -l info
postgres:
restart: always
image: postgres:latest
expose:
- "5432"
volumes:
- pgdata:/var/lib/postgresql/data/
redis:
restart: always
image: redis:latest
expose:
- "6379"
volumes:
- redisdata:/data
rabbitmq:
restart: always
image: rabbitmq:3-management
environment:
RABBITMQ_DEFAULT_USER: 'adminuser'
RABBITMQ_DEFAULT_PASS: 'xxxxxxxxx'
RABBITMQ_DEFAULT_VHOST: 'myvhost'
ports:
- "15672:15672"
expose:
- "5672"
volumes:
elk-data:
pgdata:
redisdata:
web-data:
web-ffmpeg-data:
ソフトウェアバージョン:
私も2つのワークステーションの間のすべてのバージョンと一致しました。バージョンが
- ドッカー1.12.5あり、1.13.0
- ドッカー-COMPOSE 1.11.0、1.11.1
私はバージョンのすべての組み合わせを試しても同じ問題が存在します。
ドッカーマシンでドッカーを使用する場合と、ubuntuマシンで直接使用する場合で異なる点は何ですか?