nginx - docker stack deploy is not working properly but docker-compose is working properly -


i new docker swarm , docker compose.

i built application uses nginx , flask docker containers. nginx acts reverse proxy.

when building entire application using docker compose works fine

my docker-compose.yml file

version: '2'  services:   web:     restart:     build: ./web     image: shivanand3939/web     expose:       - "8000"     volumes:       - ./output:/usr/src/app/static     command: /usr/local/bin/gunicorn -w 2 -b :8000 --access-logfile - classifierv2restendpoint_ridge_nb:create_app()    nginx:     build: ./nginx/     image: shivanand3939/nginx     ports:       - "80:80"     volumes:       - /www/static     volumes_from:       - web     links:       - web:web    viz:     image: dockersamples/visualizer     ports:       - 8080:8080/tcp     volumes:       - /var/run/docker.sock:/var/run/docker.sock     environment:       - "constraint=node.role==manager" 

below output:

enter image description here

however, want take next level deploying in 3 aws instances

here docker-stack.yml file

version: '3'  networks:   mybridge:  services:   web:     restart:     build: ./web     image: shivanand3939/web     expose:       - "8000"     volumes:       - ./output:/usr/src/app/static     command: /usr/local/bin/gunicorn -w 2 -b :8000 --access-logfile - classifierv2restendpoint_ridge_nb:create_app()        networks:       mybridge:         aliases:           - web     deploy:       replicas: 2       update_config:         parallelism: 2         delay: 10s       restart_policy:         condition: on-failure    nginx:     restart:     build: ./nginx/     image: shivanand3939/nginx     ports:       - "80:80"     volumes:       - /www/static     networks:       - mybridge     deploy:       replicas: 1       update_config:         parallelism: 2         delay: 10s       restart_policy:         condition: on-failure    viz:     image: dockersamples/visualizer     ports:       - 8080:8080/tcp     volumes:       - /var/run/docker.sock:/var/run/docker.sock     deploy:       placement:         constraints: [node.role == manager] 

but when deploy application , check url getting

[incorrect home page]

enter image description here

i not understanding why in first case there communication between web , nginx containers in second case communication stopped.

can please guide me on this

update 1:

upon looking @ nginx service logs see,

classifierbot_nginx.1.qhi4b9c1yc3n@ip-172-31-16-132    | 2017/09/11 06:49:50 [error] 5#5: *10 "/usr/share/nginx/html/phpmyadmin2013/index.html" not found (2: no such file or directory), client: 10.255.0.2, server: localhost, request: "head http://35.154.66.136:80/phpmyadmin2013/ http/1.1", host: "35.154.66.136" classifierbot_nginx.1.qhi4b9c1yc3n@ip-172-31-16-132    | 10.255.0.2 - - [11/sep/2017:06:49:50 +0000] "head http://35.154.66.136:80/phpmyadmin2014/ http/1.1" 404 0 "-" "mozilla/5.0 jorgee" "-" classifierbot_nginx.1.qhi4b9c1yc3n@ip-172-31-16-132    | 2017/09/11 06:49:50 [error] 5#5: *10 "/usr/share/nginx/html/phpmyadmin2014/index.html" not found (2: no such file or directory), client: 10.255.0.2, server: localhost, request: "head http://35.154.66.136:80/phpmyadmin2014/ http/1.1", host: "35.154.66.136" classifierbot_nginx.1.qhi4b9c1yc3n@ip-172-31-16-132    | 10.255.0.2 - - [11/sep/2017:06:49:51 +0000] "head http://35.154.66.136:80/phpmyadmin2016/ http/1.1" 404 0 "-" "mozilla/5.0 jorgee" "-" classifierbot_nginx.1.qhi4b9c1yc3n@ip-172-31-16-132    | 2017/09/11 06:49:51 [error] 5#5: *16 "/usr/share/nginx/html/phpmyadmin2016/index.html" not found (2: no such file or directory), client: 10.255.0.2, server: localhost, request: "head http://35.154.66.136:80/phpmyadmin2016/ http/1.1", host: "35.154.66.136" classifierbot_nginx.1.qhi4b9c1yc3n@ip-172-31-16-132    | 2017/09/11 06:49:52 [error] 5#5: *17 "/usr/share/nginx/html/phpmyadmin2017/index.html" not found (2: no such file or directory), client: 10.255.0.2, server: localhost, request: "head http://35.154.66.136:80/phpmyadmin2017/ http/1.1", host: "35.154.66.136" classifierbot_nginx.1.qhi4b9c1yc3n@ip-172-31-16-132    | 10.255.0.2 - - [11/sep/2017:06:49:52 +0000] "head http://35.154.66.136:80/phpmyadmin2017/ http/1.1" 404 0 "-" "mozilla/5.0 jorgee" "-" classifierbot_nginx.1.qhi4b9c1yc3n@ip-172-31-16-132    | 10.255.0.2 - - [11/sep/2017:06:49:55 +0000] "head http://35.154.66.136:80/phpmyadmin2018/ http/1.1" 404 0 "-" "mozilla/5.0 jorgee" "-" classifierbot_nginx.1.qhi4b9c1yc3n@ip-172-31-16-132    | 2017/09/11 06:49:55 [error] 5#5: *18 "/usr/share/nginx/html/phpmyadmin2018/index.html" not found (2: no such file or directory), client: 10.255.0.2, server: localhost, request: "head http://35.154.66.136:80/phpmyadmin2018/ http/1.1", host: "35.154.66.136" classifierbot_nginx.1.qhi4b9c1yc3n@ip-172-31-16-132    | 10.255.0.2 - - [11/sep/2017:06:49:57 +0000] "head http://35.154.66.136:80/phpmanager/ http/1.1" 404 0 "-" "mozilla/5.0 jorgee" "-" classifierbot_nginx.1.qhi4b9c1yc3n@ip-172-31-16-132    | 2017/09/11 06:49:57 [error] 5#5: *19 "/usr/share/nginx/html/phpmanager/index.html" not found (2: no such file or directory), client: 10.255.0.2, server: localhost, request: "head http://35.154.66.136:80/phpmanager/ http/1.1", host: "35.154.66.136" 


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -