H
H
Hikmat Abdunabiev2018-04-06 15:10:02
Docker
Hikmat Abdunabiev, 2018-04-06 15:10:02

Why is docker swarm not letting some requests through?

Hello!
The stack is launched in docker swarm via the command:
docker stack deploy -c docker-compose.yml prod
The stack has nginx services (ports 80, 443) and nodejs (port 3000). When accessing both nginx and nodejs, requests are processed through time.
1st request to nginx:

curl -L http://192.168.1.2/ping
curl: (7) Failed to connect to 192.168.105.2 port 80: Нет маршрута до узла

immediately following query:
curl -L http://192.168.1.2/ping
{"time":"2018-04-06T11:51:02.869Z","status":"OK"}

And so it goes in circles.
The most interesting thing is that if you go inside the running container and check the request from there, then everything is processed normally and there are no errors. And also if you run docker-compose.yml through docker-compose, and not in swarm mode, then everything also works properly and there are no errors.
Please indicate in which direction to dig. Or has anyone else experienced this?
Thank you very much in advance!
docker-compose.yml
version: "3.6"

services:
    nginx:
        image: nginx:latest
        depends_on:
            - my-app
        ports: 
            - 80:80
            - 443:443
        volumes:
            #- /etc/letsencrypt:/etc/letsencrypt:ro
            - /home/project/data/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
            - /home/project/data/nginx/conf.d:/etc/nginx/conf.d
            - /home/project/public:/var/public
        networks:
            - my-network
        deploy:
            placement:
                constraints: [node.role == manager]
            replicas: 1
            update_config:
                parallelism: 1
                delay: 5s
            restart_policy:
                condition: on-failure
                max_attempts: 3
                window: 120s

    my-app:
        image: staging.smartlab.uz:5005/smartlab/ucell/ucell-app
        env_file:
            - /home/project/project.env
        ports:
            - 3000:3000
        volumes:
            - /usr/src/app/node_modules
            - /home/project/public:/usr/src/app/public
        networks:
            - my-network
        command: bash -c "npm start"
        deploy:
            replicas: 1
            update_config:
                parallelism: 1
                delay: 5s        

networks:
    my-network:

docker version
Client:
 Version:	18.03.0-ce
 API version:	1.37
 Go version:	go1.9.4
 Git commit:	0520e24
 Built:	Wed Mar 21 23:10:01 2018
 OS/Arch:	linux/amd64
 Experimental:	false
 Orchestrator:	swarm

Server:
 Engine:
  Version:	18.03.0-ce
  API version:	1.37 (minimum version 1.12)
  Go version:	go1.9.4
  Git commit:	0520e24
  Built:	Wed Mar 21 23:08:31 2018
  OS/Arch:	linux/amd64
  Experimental:	false

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question