1、初始化docker环境:
yum install -y epel-release
curl -fsSL https://get.docker.com/ | sh
systemctl daemon-reload
systemctl enable docker.service
systemctl restart docker.service
docker network create kong-net
2、安装数据库:
docker run -d --name kong-database \
-p 5432:5432 \
-e "POSTGRES_USER=kong" \
-e "POSTGRES_DB=kong" \
-e "POSTGRES_PASSWORD=your_pg_password" \
postgres:9.6
3、初始化数据库
docker run --rm \
--link kong-database:kong-database \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-database" \
-e "KONG_PG_PASSWORD=your_pg_password" \
-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
kong:latest kong migrations bootstrap
psql --host=127.0.0.1 --username=kong --password --dbname=kong
4、启动kong
docker run -d --name kong \
--link kong-database:kong-database \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-database" \
-e "KONG_PG_PASSWORD=your_pg_password" \
-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, 0.0.0.0:8444 ssl" \
-p 8000:8000 \
-p 8443:8443 \
-p 8001:8001 \
-p 8444:8444 \
kong:latest
docker network connect kong-net kong
5、安装kong-dashboard
docker run --rm --network kong-net -p 8080:8080 pgbi/kong-dashboard start --kong-url http://kong:8001
6、安装kong_dashboard:
docker run -p 1337:1337 --network kong-net --name konga -e "NODE_ENV=development" -e "TOKEN_SECRET=aaaaaa" pantsel/konga
访问konga:http://ip:1337
将kong的管理url加入konga:http://kong:8001
查看日志映射:docker inspect –format=’{{.LogPath}}’ kong
查看日志:
tail -f /var/lib/docker/containers/xxx-json.log标签:run,centos,database,--,KONG,docker,kong From: https://blog.51cto.com/u_15967457/6065091