ルートにあるstart.shを実行してloalhostへアクセスすると503 Service Temporarily Unavailableと出てきてしまいます。loalhostへアクセスするとメインのアプリケーション。サブドメインで別コンテナに作るアプリケーションへ接続させたいです。よろしくお願いいたします。
https://github.com/ErgoFriend/test_app.git
webapp/
dockercompose
1version: '3' 2 3networks: 4 default: 5 external: 6 name: common_link 7volumes: 8 ark-volume: 9 driver: 'local' 10services: 11 web: 12 build: . 13 command: python manage.py runserver 0.0.0.0:8000 14 volumes: 15 - .:/web 16 environment: 17 VIRTUAL_HOST: loalhost 18 links: 19 - db 20 depends_on: 21 - db 22 db: 23 image: postgres:10 24 environment: 25 POSTGRES_DB: "database" 26 POSTGRES_USER: "postgres" 27 POSTGRES_PASSWORD: "postgres" 28 ports: 29 - 5432:5432 30 volumes: 31 - ~/docker/postgres:/var/lib/postgresql/homepagedata 32 # uwsgi: 33 # build: . 34 # command: ./config/uwsgi.sh 35 # volumes: 36 # - /static 37 # links: 38 # - web 39 #Ark's homepage container 40
Dockerfile
1FROM python:3 2RUN groupadd -r uwsgi && useradd -r -g uwsgi uwsgi 3ENV PYTHONUNBUFFERED 1 4RUN mkdir /web 5WORKDIR /web 6ADD requirements.txt /web/ 7RUN pip install -r requirements.txt 8ADD . /web/ 9RUN chown -R uwsgi /web 10COPY uwsgi.sh /uwsgi.sh 11RUN chmod +x /uwsgi.sh
requriements
1Django==2.0.7 2psycopg2-binary 3psycopg2 4pillow 5uwsgi
nginx-proxy/
dockercompose
1version: '3' 2 3networks: 4 default: 5 external: 6 name: common_link 7 8services: 9 nginx-proxy: 10 image: jwilder/nginx-proxy:latest 11 privileged: true 12 ports: 13 - "80:80" 14 - "443:443" 15 environment: 16 DEFAULT_HOST: loaclhost 17 volumes: 18 - /var/run/docker.sock:/tmp/docker.sock:ro 19 - /var/www/certs:/etc/nginx/certs 20 - /var/www/htpasswd:/etc/nginx/htpasswd 21 restart: always 22 # letsencrypt: 23 # image: jrcs/letsencrypt-nginx-proxy-companion 24 # volumes: 25 # - /var/www/certs:/etc/nginx/certs:rw 26 # - /var/run/docker.sock:/var/run/docker.sock:ro 27 # depends_on: 28 # - nginx-proxy 29 # restart: always 30 # nginx: 31 # image: nginx 32 # links: 33 # - uwsgi 34 # ports: 35 # - "0.0.0.0:80:80" 36 # command: /bin/bash && nginx -g 'daemon off;' 37 # volumes: 38 # - /static 39 # - ./src:/src 40 # - ./config/nginx:/etc/nginx/conf.d
conf
1user nginx; 2worker_processes 1; 3 4error_log /var/log/nginx/error.log warn; 5pid /var/run/nginx.pid; 6 7 8events { 9 worker_connections 1024; 10} 11 12 13http { 14 include /etc/nginx/mime.types; 15 default_type application/octet-stream; 16 17 log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 18 '$status $body_bytes_sent "$http_referer" ' 19 '"$http_user_agent" "$http_x_forwarded_for"'; 20 21 access_log /var/log/nginx/access.log main; 22 23 sendfile on; 24 #tcp_nopush on; 25 26 keepalive_timeout 65; 27 28 #gzip on; 29 30 upstream uwsgi { 31 server uwsgi:5000; 32 } 33 34 server { 35 listen 80; 36 charset utf-8; 37 38 location / { 39 uwsgi_pass uwsgi; 40 include uwsgi_params; 41 } 42 43 location /static { 44 alias /static; 45 } 46 47 location /media { 48 alias /media; 49 } 50 51}
terminal
1├── build.sh 2├── nginx-proxy 3│ ├── docker-compose.yml 4│ └── nginx.conf 5├── start.sh 6└── webapp 7 ├── Dockerfile 8 ├── db.sqlite3 9 ├── docker-compose.yml 10 ├── manage.py 11 ├── mysite 12 ├── requirements.txt 13 └── uwsgi.sh
sh
1#!/bin/sh 2yes | docker network create --driver bridge common_link 3cd nginx-proxy 4sudo docker-compose up -d 5cd ../webapp 6sudo docker-compose up
あなたの回答
tips
プレビュー