This an extension of the official Docker image for Kong, with support to for Rancher, Kubernetes, or Tutum/Docker Cloud.
The official docker-kong
image allows for:
1. linking `Cassandra` or `Postgres` database containers
2. connecting to external databases via custom `kong.yml` config file by replacing the `/etc/kong/` volume.
However when using Rancher
or Kubernetes
, containers are organised into Services
deployed across multiple machine node clusters. Therefore it's not feasible to mount custom config files into volumes on each machine which are spun up and down on demand. See related question here
By configuring Cassandra
and Postgres
purely using Environment Variables, it is a lot easier to point to an external RDS or InstaClustr instance.
0.8.0
- (Dockerfile)0.8.1
- (Dockerfile)latest
- (Dockerfile)
Existing docker-kong
usages still applies. The following extra Environment Variables are added:
Env Var | Default | Description |
---|---|---|
DATABASE | cassandra | either cassandra or postgres as per official image |
CLUSTER_LISTEN | 0.0.0.0:7946 | host ip and port. When rancher is specified, the Rancher Meta Data Service to work out the correct container ip address for cluster_listen . Other platforms can be extended quite easily. |
Example:
If using Rancher:
$ docker run -d --name kong
-e "CLUSTER_LISTEN=rancher" \
--link kong-database:kong-database \
-p 8000:8000 -p 8443:8443 -p 8001:8001 -p 7946:7946 -p 7946:7946/udp \
littlebaydigital/kong
If using a custom IP:
$ docker run -d --name kong
-e "CLUSTER_LISTEN=52.5.149.55:7946" \
--link kong-database:kong-database \
-p 8000:8000 -p 8443:8443 -p 8001:8001 -p 7946:7946 -p 7946:7946/udp \
littlebaydigital/kong
Env Var | Default | Description |
---|---|---|
CASSANDRA_CONTACT_POINTS | kong-database:9046 | Optional. Defaults to linked container alias. Specify custom values in the format of \"ip1:9046\",\"ip2:9046\" |
CASSANDRA_KEYSPACE | kong | Optional |
CASSANDRA_USER | kong | Optional |
CASSANDRA_PASSWORD | kong | Optional |
Example:
$ docker run -d --name kong \
-e "DATABASE=cassandra" \
-e "CASSANDRA_CONTACT_POINTS=\"52.5.149.55:9042\",\"52.5.149.56:9042\"" \
-e "CASSANDRA_KEYSPACE=kong" \
-e "CASSANDRA_USER=cassandra" \
-e "CASSANDRA_PASSWORD=cassandra" \
-p 8000:8000 -p 8443:8443 -p 8001:8001 -p 7946:7946 -p 7946:7946/udp \
--security-opt seccomp:unconfined \
littlebaydigital/kong
Env Var | Default | Description |
---|---|---|
POSTGRES_HOST | kong-database | Optional. Defaults to linked container alias |
POSTGRES_PORT | 5432 | Optional. |
POSTGRES_DATABASE | kong | Optional. |
POSTGRES_USER | kong | Optional. |
POSTGRES_PASSWORD | kong | Optional. |
Example:
$ docker run -d --name kong \
-e "DATABASE=cassandra" \
-e POSTGRES_HOST=127.0.0.1 \
-e POSTGRES_PORT=5432 \
-e POSTGRES_DB=kong \
-e POSTGRES_USER=kong \
-e POSTGRES_PASSWORD=kong \
-p 8000:8000 -p 8443:8443 -p 8001:8001 -p 7946:7946 -p 7946:7946/udp \
--security-opt seccomp:unconfined \
littlebaydigital/kong