Giter Club home page Giter Club logo

docker-register's Introduction

docker-register sets up a container running docker-gen. docker-gen dynamically generate a python script when containers are started and stopped. This generated script registers the running containers host IP and port in etcd with a TTL. It works in tandem with docker-discover which generates haproxy routes on the host to forward requests to registered containers.

Together, they implement service discovery for docker containers with a similar architecture to SmartStack. docker-register is analagous to nerve in the SmartStack system.

See also Docker Service Discovery Using Etcd and Haproxy

Usage

To run it:

$ docker run -d -e HOST_IP=1.2.3.4 -e ETCD_HOST=1.2.3.4:4001 -v /var/run/docker.sock:/var/run/docker.sock -t jwilder/docker-register

Then start any containers you want to be discoverable and publish their exposed port to the host.

$ docker run -d -P -t ...

If you run the container on multiple hosts, they will be grouped together automatically.

Limitations

There are a few simplications that were made:

  • Containers can only expose one port - This is a simplification but if the container EXPOSEs multiple ports, it won't be registered in etcd.
  • Exposed ports must be unique to the service - Each container must expose it's service on a unique port. For example, if you have two different backend web services and they both expose their service over port 80, then one will need to use a port 80 and the other a different port.

TODO

  • Support http, udp proxying
  • Support multiple ports
  • Make ETCD prefix configurable
  • Support other backends (consul, zookeeper, redis, etc.)

docker-register's People

Contributors

jwilder avatar rca avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.