Kong: Kong setup issue using docker

Created on 5 Feb 2018  Â·  1Comment  Â·  Source: Kong/kong

I followed https://hub.docker.com/_/kong/ document to setup kong using docker.
Once after setting up kong-database container, I see below error trace on starting up kong container

root@jpdevserver:/home/jp# docker run --name kong \
>     --link kong-database:kong-database \
>     -e "KONG_DATABASE=postgres" \
>     -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
prefix directory /usr/local/kong not found, trying to create it
2018/02/05 14:47:21 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:159: bad argument #2 to 'assert' (string expected, got table)
stack traceback:
    [C]: in function 'assert'
    /usr/local/share/lua/5.1/kong/init.lua:159: in function 'init'
    init_by_lua:3: in main chunk
nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:159: bad argument #2 to 'assert' (string expected, got table)
stack traceback:
    [C]: in function 'assert'
    /usr/local/share/lua/5.1/kong/init.lua:159: in function 'init'
    init_by_lua:3: in main chunk


root@jpdevserver:/home/jp# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                    NAMES
aa1a38e6d609        postgres:9.5        "docker-entrypoint.s…"   About a minute ago   Up About a minute   0.0.0.0:5432->5432/tcp   kong-database
root@jpdevserver:/home/jp#

Most helpful comment

I couldn't reproduce. I think you're missing -e "KONG_PG_HOST=kong-database" \

docker run -d --name kong-database \
                -p 5432:5432 \
                -e "POSTGRES_USER=kong" \
                -e "POSTGRES_DB=kong" \
                postgres:9.5
docker run --rm \
    --link kong-database:kong-database \
    -e "KONG_DATABASE=postgres" \
    -e "KONG_PG_HOST=kong-database" \
    kong kong migrations up
docker run -d --name kong \
    --link kong-database:kong-database \
    -e "KONG_DATABASE=postgres" \
    -e "KONG_PG_HOST=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

>All comments

I couldn't reproduce. I think you're missing -e "KONG_PG_HOST=kong-database" \

docker run -d --name kong-database \
                -p 5432:5432 \
                -e "POSTGRES_USER=kong" \
                -e "POSTGRES_DB=kong" \
                postgres:9.5
docker run --rm \
    --link kong-database:kong-database \
    -e "KONG_DATABASE=postgres" \
    -e "KONG_PG_HOST=kong-database" \
    kong kong migrations up
docker run -d --name kong \
    --link kong-database:kong-database \
    -e "KONG_DATABASE=postgres" \
    -e "KONG_PG_HOST=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
Was this page helpful?
0 / 5 - 0 ratings