Kong / kong

🦍 The Cloud-Native API Gateway and AI Gateway.
https://konghq.com/install/#kong-community
Apache License 2.0
39.24k stars 4.81k forks source link

Error when trying to kong on docker #10458

Closed liudonghua123 closed 1 year ago

liudonghua123 commented 1 year ago

Is there an existing issue for this?

Kong version ($ kong version)

3.2.1

Current Behavior

I tried to run kong followed the docs on https://docs.konghq.com/gateway/latest/install/docker/.

And when I execute the following command, it failed with the following errors.

[root@localhost ~]# docker network create kong-net
e7423602c16e0fd07c27326f177a2e02196370d2a83353dccff3d5f1a82904f4
[root@localhost ~]#
[root@localhost ~]#  docker run -d --name kong-database \
>   --network=kong-net \
>   -p 5432:5432 \
>   -e "POSTGRES_USER=kong" \
>   -e "POSTGRES_DB=kong" \
>   -e "POSTGRES_PASSWORD=kongpass" \
>   postgres:13
3f4be3f294944dee2df65d58181eb82389c9a73b66274095efe007302a06a149
[root@localhost ~]# 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=kongpass" \
>   -e "KONG_PASSWORD=test" \
>  kong/kong-gateway:3.2.1.0 kong migrations bootstrap --v
2023/03/09 02:32:20 [verbose] Kong: 3.2.1.0-enterprise-edition
2023/03/09 02:32:20 [verbose] no config file found at /etc/kong/kong.conf
2023/03/09 02:32:20 [verbose] no config file found at /etc/kong.conf
2023/03/09 02:32:20 [verbose] no config file, skip loading
2023/03/09 02:32:20 [verbose] prefix in use: /usr/local/kong
2023/03/09 02:32:20 [verbose] preparing nginx prefix directory at /usr/local/kong
2023/03/09 02:32:20 [verbose] SSL enabled on 
2023/03/09 02:32:20 [verbose] generating /usr/local/kong/ssl/kong-default.crt SSL certificate (
2023/03/09 02:32:20 [verbose] generating /usr/local/kong/ssl/kong-default-ecdsa.crt SSL certificate (
2023/03/09 02:32:20 [verbose] SSL enabled on 
2023/03/09 02:32:20 [verbose] generating /usr/local/kong/ssl/admin-kong-default.crt SSL certificate (
2023/03/09 02:32:21 [verbose] generating /usr/local/kong/ssl/admin-kong-default-ecdsa.crt SSL certificate (
2023/03/09 02:32:21 [verbose] SSL enabled on 
2023/03/09 02:32:21 [verbose] generating /usr/local/kong/ssl/admin-gui-kong-default.crt SSL certificate (
2023/03/09 02:32:21 [verbose] generating /usr/local/kong/ssl/admin-gui-kong-default-ecdsa.crt SSL certificate (
2023/03/09 02:32:21 [verbose] generating trusted certs combined file in 
Error: 
/usr/local/share/lua/5.1/kong/cmd/migrations.lua:222: 
stack traceback:
    [C]: in function 'assert'
    /usr/local/share/lua/5.1/kong/cmd/migrations.lua:222: in function 'cmd_exec'
    /usr/local/share/lua/5.1/kong/cmd/init.lua:104: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:104>
    [C]: in function 'xpcall'
    /usr/local/share/lua/5.1/kong/cmd/init.lua:104: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:61>
    /usr/local/bin/kong:9: in function 'file_gen'
    init_worker_by_lua:48: in function <init_worker_by_lua:46>
    [C]: in function 'xpcall'
    init_worker_by_lua:55: in function <init_worker_by_lua:53>
[root@localhost ~]#
[root@localhost ~]# docker ps|grep kong
3f4be3f29494        postgres:13                  "docker-entrypoint.s…"   4 minutes ago       Up 4 minutes        0.0.0.0:5432->5432/tcp                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   kong-database
[root@localhost ~]# docker ps -a|grep kong
3f4be3f29494        postgres:13                          "docker-entrypoint.s…"   4 minutes ago       Up 4 minutes                0.0.0.0:5432->5432/tcp                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   kong-database
6698c1a3f490        kong/kong-gateway:3.2.1.0            "/entrypoint.sh kong…"   32 minutes ago      Exited (1) 32 minutes ago                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            kong-gateway
[root@localhost ~]#
[root@localhost ~]# docker --version
Docker version 19.03.13, build 4484c46d9d
[root@localhost ~]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[root@localhost ~]#

Expected Behavior

No errors when try to prepare the Kong database.

docker run --rm --network=kong-net \
  -e "KONG_DATABASE=postgres" \
  -e "KONG_PG_HOST=kong-database" \
  -e "KONG_PG_PASSWORD=kongpass" \
  -e "KONG_PASSWORD=test" \
 kong/kong-gateway:3.2.1.0 kong migrations bootstrap

Steps To Reproduce

 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=kongpass" \
  postgres:13

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=kongpass" \
  -e "KONG_PASSWORD=test" \
 kong/kong-gateway:3.2.1.0 kong migrations bootstrap --v

 docker run -d --name kong-gateway \
  --network=kong-net \
  -e "KONG_DATABASE=postgres" \
  -e "KONG_PG_HOST=kong-database" \
  -e "KONG_PG_USER=kong" \
  -e "KONG_PG_PASSWORD=kongpass" \
  -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_GUI_URL=http://localhost:8002" \
  -e KONG_LICENSE_DATA \
  -p 8000:8000 \
  -p 8443:8443 \
  -p 8001:8001 \
  -p 8444:8444 \
  -p 8002:8002 \
  -p 8445:8445 \
  -p 8003:8003 \
  -p 8004:8004 \
  kong/kong-gateway:3.2.1.0

Anything else?

No response

hbagdi commented 1 year ago

I can't seem to reproduce this one. Can you verify if the docker image on your work station is up to date?

docker pull kong/kong-gateway:3.2.1.0

3.2.1.0: Pulling from kong/kong-gateway
Digest: sha256:4b189402fd3ba27a15eaac475d1b362f06da40a423ff26cc8b76933cb974cd40
Status: Image is up to date for kong/kong-gateway:3.2.1.0
docker.io/kong/kong-gateway:3.2.1.0
liudonghua123 commented 1 year ago

I verified the docker images. it's the latest 3.2.1.0 indeed.

[root@localhost ~]# docker images|grep kong
kong/kong-gateway              3.2.1.0                      864cfac0b156        10 days ago         383MB
[root@localhost ~]# docker pull kong/kong-gateway:3.2.1.0
3.2.1.0: Pulling from kong/kong-gateway
Digest: sha256:4b189402fd3ba27a15eaac475d1b362f06da40a423ff26cc8b76933cb974cd40
Status: Image is up to date for kong/kong-gateway:3.2.1.0
docker.io/kong/kong-gateway:3.2.1.0
[root@localhost ~]#
ghost commented 1 year ago

I can't reproduce this also.

docker images|grep kong
kong/kong-gateway             3.2.1.0      864cfac0b156   10 days ago     383MB
liudonghua123 commented 1 year ago

I also posted the same issue on https://github.com/Kong/docker-kong/issues/633 and @gszr had some clues about this problems.

StarlightIbuki commented 1 year ago

Since the issue is tracked at a different repo I'm closing the ticket. Please feel free to reopen it if you have any further concerns.