In all of these instances, there is one primary services and secondary support services. When the secondary support services fail, they should be automatically restarted. When the primary service fails, the container itself should restart.

Usage

To use this image include FROM smebberson/alpine-consul at the top of your Dockerfile, or simply docker run --name consul smebberson/alpine-consul.

This setup serves the purpose of a single Consul agent running on a host, mainly for testing. This isn't the recommended scenario, with 3 to 5 total servers per data centre being preferred. However, you can easily customise this by providing your own config.json file as discussed below.

Although easily customisable, this image has been designed to run Consul in server mode (without the web ui). If you'd like an image with Consul's web ui, refer to smebberson/consul-ui.

Customisation

This container comes setup as follows:

s6 will automatically start Consul for you

if Consul dies, it will automatically be restarted

All configuration has been defined in the root/etc/consul.d/bootstrap/config.json file (relative to this directory).

To customise configuration for consul, replace the file at root/etc/consul.d/bootstrap/config.json with your own configuration.

To customise the start script for consul, replace the file at root/etc/services.d/consul/run with your own start script.