I got this architecture and it is **almost** working. 

* I can `curl` the service directly and it dispatches the requests to the replicas running behind.
* Also I can curl the `nginx` container.
* Additionally I can run `docker exec -i nginx curl http://articleservice:8080/somemethod` without any issues.

But something seems to be wrong with my config. The nginx and the container are on the same network. 

> 
> Architecture:
> 
> 
> 

```
                                             [replica 2]
                                            /
[incoming traffic] -> [nginx] -> [service a]
                                            \
                                             [replica 1]

```

> 
> docker-compose.yml
> 
> 
> 

```
version: "3"
services:
  articleservice:
    image: elps/articleservice:1.1.0.5
    deploy:
      replicas: 2
      restart_policy:
        condition: on-failure
      placement:
        constraints:
          - node.role == manager
    ports:
      - "8080:8080"
    environment:
      - MYSQL_HOST=192.168.178.96
      - MYSQL_DB=catalog
      - MYSQL_USER=root
      - MYSQL_PASSWORD=root
    networks:
      - webnet     

  nginx-default:
    image: nginx
    deploy:
      restart_policy:
        condition: on-failure
      placement:
        constraints:
          - node.role == manager
    ports:
      - "80:80"
    networks:
      - webnet

networks:
  webnet:

```

> 
> **nginx-config**
> 
> 
> 

```
server {
  listen 80;
  listen [::]:80;

  server_name example.com;

  location /article {
      proxy_pass http://articleservice:8080/; 
  }
}

```