Official Consul Docker Image

Official Consul Docker Image

May 05 2016 James Phillips

We are pleased to announce the release of our official Docker image for Consul. Consul is a modern datacenter runtime that provides service discovery, configuration, and orchestration capabilities.

The official Docker image makes a development or production cluster just one command away for any Docker-powered clusters. Through the review process, we've worked closely with the folks at Docker to iterate and make an image that's safe, intuitive, and easy to use.

Consul is our first tool to have an official Docker image. We’ll be updating the Docker image alongside all new releases of Consul. More HashiCorp tooling will be distributed as Docker images going forward.

Development and Production

We spent a lot of time and effort to ensure that the single Docker image can be used for both development and production. With just a few different command-line flags, you’re a single docker run consul away from a cluster at home or in a production datacenter.

Consul and Docker for Development

At HashiCorp, we strive for a great out-of-box experience for all our tooling. Our Docker image is no different: we knew that docker run consul would be the first thing people did to try Consul with Docker, so we optimized the defaults for development.

When you run docker run consul, you get a working development Consul server running instantly:

$ docker run consul ==> Starting Consul agent... ==> Starting Consul agent RPC... ==> Consul agent running!

This configures Consul to be completely in-memory with default Docker networking and no services exposed to the host. This is perfect for development where you want to test or use the API without having to configure a cluster.

Development mode also starts the Consul web UI on port 8500, giving users a graphical interface to interact with their Consul cluster.

Consul and Docker for Production

To run Consul in production, you just have to docker run consul agent. This will directly run the consul agent command, disable all the development defaults, and enable all the production defaults.

To ensure the Docker image is practical for production, we included a number of features:

  • The entry point script automatically sets Consul’s persistent data directory to a location on a volume for easy state management.

  • Consul can be configured to bind to an interface or set its client interface by setting CONSUL_BIND_INTERFACE and/or CONSUL_CLIENT_INTERFACE environment variables. Production Docker clusters often have many networking interfaces and this makes it easy to bind to the correct one.

  • The CONSUL_LOCAL_CONFIG environment variable allows configuration JSON to be included in the image on the fly without having to compose a new container or mount a volume.

The full documentation

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×