Public | Automated Build

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


An image for using consul within Docker containers, bundled with Alpine Linux and s6.

Yet another container for running Consul?

Yes, as this one is built from smebberson/alpine-base that contains s6 for process management. Small, fast and with s6.

Aren't you only supposed to run one process per container?

Hell no! The following are good examples of when multiple processes within one container might be necessary:

  • Automatically updating nginx proxy settings when a down-stream application server (nodejs, php, etc) restarts (and the IP changes).
  • Automatically updating HAProxy configuration to load balance to a group of down-stream application servers.
  • Running a logging daemon to centralize log management (i.e. logentries, loggly, logstash).
  • When you need to run a script on application server crash (to tidy something up), as the standard Docker container restart policies won't provide this.

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.


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

By default, Consul has been configured with:

    "bootstrap_expect": 1,
    "server": true,
    "node_name": "agent-bootstrapped",
    "data_dir": "/data"

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.


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.

Docker Pull Command
Source Repository