Public | Automated Build

Last pushed: 3 years ago
Short Description
Short description is empty for this repo.
Full Description



Docker container for confd configured nginx based on etcd values generated by Registrator. Mainly for CoreOS cluster.

I started with DigitalOcean's Confd and Etcd but I don't like the idea of sidekick instance. I changed sidekick to Registrator and make some changes in Confd configuration.

Pre-Requirements for cluster configuration

This docker image made for CoreOs cluster. (Detailed cluster setup soon.) You need working Registrators on every cluster nodes and need to create docker Fleet units named with domain name and instance. For example if you would like to run a Wordpress unit you need to name the docker instance to ''.

docker run --name --link some-mysql:mysql -p 80 -d wordpress

Registrator will create a key for '' docker instance at '/services/wordpress/' with the IP address of the docker instance and port of the Wordpress. For example: ''

How to use this image

docker run --name -p 80:80 -e -e -e HOST_IP= tarhelypark/nginx-confd-etcd

The following environment variables available:

  • -e NGINX_BACKEND_SERVICE=... (name of backend service instance, in our example)
  • -e NGINX_DEMO_DOMAIN=... (demo domain name which also forwarded to backend. If you specify will be forwarded to
  • -e HOST_IP=... (IP of etcd)
  • -e ETCD_PORT=... (public port of etcd default: 4001)
  • -e NGINX_WORKER_PROCESSES=... (number of nginx worker processes, default: cpu x 2)

Fleet config

Following configuration will start Nginx on every machine on the cluster and dinamicaly create configuration and proxy routing to every working Wordpress (or any other) instance.

Description=Nginx proxy and load balancer


# Get CoreOS environmental variables

ExecStartPre=-/usr/bin/docker kill %p.%i
ExecStartPre=-/usr/bin/docker rm %p.%i
ExecStartPre=/usr/bin/docker pull tarhelypark/nginx-confd-etcd
ExecStart=/usr/bin/docker run --name %p.%i -p ${COREOS_PUBLIC_IPV4}:80:80 -e NGINX_BACKEND_SERVICE=%i -e -e HOST_IP=${COREOS_PUBLIC_IPV4} tarhelypark/nginx-confd-etcd
ExecStop=/usr/bin/docker stop %p.%i


Usefull links

Docker Pull Command
Source Repository