consul-kv-primer docker image
Consul does not provide an easy way to populate its key-value store on start-up.
This can be a problem when working locally if your application depends on config that should already be in consul's kv store (as it would be in a production-like env).
This image is designed to mitigate the issue when your target environment is started by docker-compose. Simply provide the service with the env vars required using the
The image will wait for docker to startup, then pass all its env vars using consul's http api. Once finished, it will set key
IS_CONSUL_PRIMED with value
FOO=bar HELLO=world HEY=youguys
version: '2' services: consul-kv-primer: image: totallymoney/consul-kv-primer depends_on: - consul env_file: ./.env environment: - CONSUL_URL=http://consul:8500 consul: image: consul ports: - "8500:8500"
With the above in place, run the following
$ docker-compose up consul-kv-primer
Consul will then be available on port 8500 with a primed key-value store.
$ curl http://localhost:8500/v1/kv/HELLO\?raw world