Docker安装Kong及KongDashboard

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

你可能感兴趣的:(kong)