//首先创建网络
docker network create kong-net
//安装kong对应postgres数据库
docker run -d --privileged --restart always --name kong-database
--network=kong-net
-p 5432:5432
-v /data/work/kong/data:/var/lib/postgresql/data
-e "POSTGRES_USER=kong"
-e "POSTGRES_DB=kong"
-e "POSTGRES_PASSWORD=xxxxxxxxx"
postgres:9.6
//对kong在postgres数据库里做数据初始化
docker run --rm
--network=kong-net --privileged
-e "KONG_DATABASE=postgres"
-e "KONG_PG_HOST=kong-database"
-e "KONG_PG_USER=kong"
-e "KONG_PG_PASSWORD=xxxxxxxxx"
-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database"
kong:latest kong migrations bootstrap
//启动kong
chmod -R 777 /data/work/soft/kong;
docker run -d --name kong --privileged --restart always
--network=kong-net
-v /data/work/soft/kong/logs:/tmp
-e "KONG_DATABASE=postgres"
-e "KONG_PG_HOST=kong-database"
-e "KONG_PG_USER=kong"
-e "KONG_PG_PASSWORD=xxxxxxxxx"
-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database"
-e "KONG_PROXY_ACCESS_LOG=/tmp/stdout"
-e "KONG_ADMIN_ACCESS_LOG=/tmp/stdout"
-e "KONG_PROXY_ERROR_LOG=/tmp/stderr"
-e "KONG_ADMIN_ERROR_LOG=/tmp/stderr"
-e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl"
-p 8000:8000
-p 8443:8443
-p 8001:8001
-p 8444:8444
kong:latest
//创建konga对应postgres数据库
docker run -d --privileged --restart always --name konga-database
--network=kong-net
-p 5433:5432
-v /data/work/konga/data:/var/lib/postgresql/data
-e "POSTGRES_USER=konga"
-e "POSTGRES_DB=konga"
-e "POSTGRES_PASSWORD=xxxxxxxxx"
postgres:9.6
//konga在postgres数据库初始化
docker run --rm --network=kong-net
pantsel/konga:latest -c prepare -a postgres -u postgres://konga:xxxxxxxxx@konga-database:5432/konga
//启动konga
docker run -d --privileged --restart always -p 1337:1337
--network kong-net
-e "DB_ADAPTER=postgres"
-e "DB_URI=postgres://konga:xxxxxxxxx@konga-database:5432/konga"
-e "NODE_ENV=production"
-e "DB_PASSWORD=passwd123"
--name konga
pantsel/konga