安装postgres

1
2
3
4
5
6
7
8
docker run -d --restart always --name postgres \
--network=my_net \
-p 5432:5432 \
-e "POSTGRES_USER=kong" \
-e "POSTGRES_DB=kong" \
-e "POSTGRES_PASSWORD=123456" \
-v /data/docker/postgres:/var/lib/postgresql/data \
postgres:9.6

使用kong初始化postgres

1
2
3
4
5
6
docker run --rm \
--network=my_net \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=postgres" \
-e "KONG_PG_PASSWORD=123456" \
kong:latest kong migrations bootstrap

安装kong

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
docker service create \
--name kong \
--network my_net \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=postgres" \
-e "KONG_PG_PASSWORD=123456" \
-e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
-e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
-e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
--publish 8000:8000 \
--publish 8001:8001 \
--publish 8443:8443 \
--publish 8444:8444 \
--replicas 1 \
kong:latest

安装konga

1
docker service create --network my_net --name konga --publish 1337:1337 --replicas 1 pantsel/konga