1.創建network
docker network create kong-net
2.安裝數據庫
docker run -d --name kong-database \
-p 9042:9042 \
cassandra:3
3.初始化數據庫
docker run --rm \
--link kong-database:kong-database \
--network kong-net \
-e "KONG_DATABASE=cassandra" \
-e "KONG_PG_HOST=kong-database" \
-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
kong kong migrations up
3.安裝Kong
docker run -d --name kong \
--link kong-database:kong-database \
--network kong-net \
-e "KONG_DATABASE=cassandra" \
-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
-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" \
-e "KONG_ADMIN_LISTEN_SSL=0.0.0.0:8444" \
-p 8000:8000 \
-p 8443:8443 \
-p 8001:8001 \
-p 8444:8444 \
kong
4.安裝Kong-dashboard
docker run --rm --network kong-net -p 8080:8080 pgbi/kong-dashboard start --kong-url http://kong:8001
5.驗證安裝
http:{kongdaship}:8080