在 Docker 中运行 Kong,Kong 在 Web 浏览器中不显示 GUI

Posted

技术标签:

【中文标题】在 Docker 中运行 Kong,Kong 在 Web 浏览器中不显示 GUI【英文标题】:Run Kong in Docker, Kong does not show GUI in web browser 【发布时间】:2021-01-20 14:47:39 【问题描述】:

我按照教程https://docs.konghq.com/install/docker/?_ga=2.46631079.1600317329.1601919139-2083746525.1601653016

在 Docker 中运行 Kong API 网关

docker network create kong-net

docker run -d --name kong-database --network=kong-net -p 5432:5432 -e "POSTGRES_USER=kong" -e "POSTGRES_DB=kong" -e "POSTGRES_PASSWORD=kong" postgres:9.6

docker run --rm --network=kong-net -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e "KONG_PG_USER=kong" -e "KONG_PG_PASSWORD=kong" -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" kong:latest kong migrations bootstrap

docker run -d --name kong --network=kong-net -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e "KONG_PG_USER=kong" -e "KONG_PG_PASSWORD=kong" -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 127.0.0.1:8001:8001 -p 127.0.0.1:8444:8444 kong:latest

错误

migrating hmac-auth on database 'kong'...
hmac-auth migrated up to: 000_base_hmac_auth (executed)
hmac-auth migrated up to: 002_130_to_140 (executed)
hmac-auth migrated up to: 003_200_to_210 (executed)
migrating oauth2 on database 'kong'...
oauth2 migrated up to: 000_base_oauth2 (executed)
oauth2 migrated up to: 003_130_to_140 (executed)
oauth2 migrated up to: 004_200_to_210 (executed)
oauth2 migrated up to: 005_210_to_211 (executed)
migrating ip-restriction on database 'kong'...
ip-restriction migrated up to: 001_200_to_210 (executed)
migrating jwt on database 'kong'...
jwt migrated up to: 000_base_jwt (executed)
jwt migrated up to: 002_130_to_140 (executed)
jwt migrated up to: 003_200_to_210 (executed)
migrating basic-auth on database 'kong'...
basic-auth migrated up to: 000_base_basic_auth (executed)
basic-auth migrated up to: 002_130_to_140 (executed)
basic-auth migrated up to: 003_200_to_210 (executed)
migrating key-auth on database 'kong'...
key-auth migrated up to: 000_base_key_auth (executed)
key-auth migrated up to: 002_130_to_140 (executed)
key-auth migrated up to: 003_200_to_210 (executed)
migrating session on database 'kong'...
session migrated up to: 000_base_session (executed)
migrating acl on database 'kong'...
acl migrated up to: 000_base_acl (executed)
acl migrated up to: 002_130_to_140 (executed)
acl migrated up to: 003_200_to_210 (executed)
acl migrated up to: 004_212_to_213 (executed)
migrating response-ratelimiting on database 'kong'...
response-ratelimiting migrated up to: 000_base_response_rate_limiting (executed)
migrating bot-detection on database 'kong'...
bot-detection migrated up to: 001_200_to_210 (executed)
migrating acme on database 'kong'...
acme migrated up to: 000_base_acme (executed)
38 migrations processed
38 executed
Database is up-to-date

C:\Users\donhuvy>docker run -d --name kong --network=kong-net -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e "KONG_PG_USER=kong" -e "KONG_PG_PASSWORD=kong" -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 127.0.0.1:8001:8001 -p 127.0.0.1:8444:8444 kong:latest
docker: Error response from daemon: Conflict. The container name "/kong" is already in use by container "1326822f2bfefe7b5f5ab76ef630c83127eb7e5661929009c6c0187c0be711ed". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.

C:\Users\donhuvy>

从网络浏览器转到:http://localhost:8001

我也关闭了 Tomcat docker

我看不到 GUI 网页,如何解决?

【问题讨论】:

这是一道编程题? 【参考方案1】:

Kong GUI (Manager) 是kong 企业版的一部分。 如果您使用的是 kong 社区版, 看看https://pantsel.github.io/konga/,社区开发的长UI很少有其他的

【讨论】:

以上是关于在 Docker 中运行 Kong,Kong 在 Web 浏览器中不显示 GUI的主要内容,如果未能解决你的问题,请参考以下文章

kong网关怎么获取etcd端口

将 decK 指向远程运行的 Kong Gateway

docker安装kong和kong-dashboard

Docker,错误:无法运行迁移:数据库需要引导;

Kong入门及docker安装

kong的管理UI选择-konga