了解docker swarm服务端口转发

时间:2019-03-02 14:20:36

标签: docker nginx docker-swarm

我有此服务配置:

version: "3"
services:
  articleservice:
    image: elps/articleservice:1.1.0.8
    deploy:
      replicas: 3
      resources:
        limits:
          cpus: '0.50'
          memory: 500M
        reservations:
          cpus: '0.25'
          memory: 200M
      restart_policy:
        condition: any
      placement:
        constraints:
          - node.role == manager
    ports:
      - "8081:8080"

所有容器/服务(包括nginx)都使用相同的内部网络。

现在我在服务前找到了nginx,可以通过servicename:8080与后面的容器联系。我可以从群集外部使用clusterIP:8081

nginx.conf:

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

nginx代理是否跳过服务并直接连接到容器?

0 个答案:

没有答案