This is a patched version of registrator to work with Rancher's CNI networking.
It is based on this registrator fork:
I'm still waiting for it to be merged into the mainline.
Here is how to run it (in rancher):
version: '2' services: registrator: image: juliangamble/registrator network_mode: host volumes: - /var/run/docker.sock:/tmp/docker.sock command: - -rancherExternalPorts - -cleanup - consul://0.0.0.0:8500 labels: io.rancher.container.dns: 'true' com.btfin.devops.name: registrator io.rancher.scheduler.global: 'true' io.rancher.container.network: 'false'
(The project done by @carinoob to solve this problem was inspiring, but lacked the features of registrator. As you can imagine a rewrite in node was ambitious, and had some great ideas but didn't quite get there. The aim of this project was to take the ideas from that initiative and merge them back into the actual registrator project.)