docker compose将节点动态添加到nginx前端

时间:2016-09-16 08:35:46

标签: docker-compose

目前我的配置类似于以下 -

services:
  gunicorn:
    build:
      context: .
      dockerfile: Dockerfile.gunicorn
  restart: always
  ports:
    - 8001
  command: "something"

nginx:
  build:
    context: .
    dockerfile: Dockerfile.nginx
  ports:
    - 80:80
  command: "/usr/sbin/nginx"

我们希望我们的gunicorn容器能够动态扩展。为nginx服务中的新节点动态更新配置。

理想情况下,如果我使用下面的命令缩放,配置应该在nginx中自动添加 -

docker-compose scale gunicorn=2

我读了关于docker-compose的https://github.com/jwilder/nginx-proxy,但我想它需要容器配置&传递了VIRTUAL_HOST env,以便在nginx配置中动态添加。

请建议。

1 个答案:

答案 0 :(得分:0)

您最好尝试使用专为此目的设计的工具。 https://github.com/containous/traefik就是一个例子。

相关问题