Docker按照kong和kongA
百度搜索kong install,查找官网安装教程,点docker海豚图表,查看:
https://docs.konghq.com/enterprise/2.4.x/deployment/installation/docker/
安装kong,按照官网的教程:
docker pull kong/kong-gateway:2.4.1.0-alpine
docker images
docker tag
docker network create kong-ee-net
建数据库:
docker run -d --name kong-ee-database \
--network=kong-ee-net \
-p 5432:5432 \
-e "POSTGRES_USER=kong" \
-e "POSTGRES_DB=kong" \
-e "POSTGRES_PASSWORD=kong" \
postgres:9.6
导docker库数据:
docker run --rm --network=kong-ee-net \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-ee-database" \
-e "KONG_PG_PASSWORD=kong" \
-e "KONG_PASSWORD=kong" \
kong-ee kong migrations bootstrap
如果不按照官网,则:
kong kong migrations bootstrap
启动kong:
docker run -d --name kong \
--network=kong-ee-net \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-ee-database" \
-e "POSTGRES_DB=kong" \
-e "KONG_PG_USER=kong" \
-e "KONG_PG_PASSWORD=kong" \
-e "KONG_ADMIN_LISTEN=0.0.0.0:8001,0.0.0.0:8444 ssl" \
-p 8000:8000 \
-p 8001:8001 \
-p 8443:8443 \
-p 8444:8444 \
kong:latest
如果不想在kong访问地址里输入8000,把-p 8000:8000 \ 改成-p 80:8000 \ ,相当于nginx的conf端口配置
----------------------------------------------------------------
安装kongA:
docker pull pantsel/konga
导入kongA数据:
docker run --network=kong-ee-net --rm pantsel/konga -c prepare -a postgres -u \
postgresql://kong:kong@kong-ee-database:5432/konga
启动kongA:
原有的命令,会报错超时:
docker run --network=kong-net -d -p 1337:1337 -e "DB_ADAPTER=postgres" -e "DB_URI=postgres://kong:kong@kong-database:5432/konga" -e "NODE_ENV=production" –name konga pantsel/konga
把-d删除,就可以了:
docker run --network=kong-ee-net -p 1337:1337 -e "DB_ADAPTER=postgres" -e "DB_URI=postgres://kong:kong@kong-ee-database:5432/konga" -e "NODE_ENV=production" --name konga pantsel/konga
http://192.168.88.128:1337/#!/login 登录kongA
docker logs konga :查看konga报错日志