nginx-proxy docker 的nginx自动服务发现方案

registrator containerpilot 都是很不错的基于容器的服务发现以及服务状态管理方案,nginx-proxy 也是一个类似的东西,可以方便的处理服务的nginx proxy 配置

我们基于环境变量配置就可以了

参考使用

version: '2'
services:
  nginx-proxy:
    image: jwilder/nginx-proxy
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
  whoami:
    image: jwilder/whoami
    environment:
      - VIRTUAL_HOST=whoami.local

说明

以上介绍的几个东西都是不错的单机服务解决方案

参考资料

https://github.com/nginx-proxy/nginx-proxy

https://github.com/gliderlabs/registrator

https://github.com/joyent/containerpilot

https://www.joyent.com/blog/applications-on-autopilot